
kernel:     file format elf32-i386


Disassembly of section .text:

80100000 <multiboot_header>:
80100000:	02 b0 ad 1b 00 00    	add    0x1bad(%eax),%dh
80100006:	00 00                	add    %al,(%eax)
80100008:	fe 4f 52             	decb   0x52(%edi)
8010000b:	e4 0f                	in     $0xf,%al

8010000c <entry>:

# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
  # Turn on page size extension for 4Mbyte pages
  movl    %cr4, %eax
8010000c:	0f 20 e0             	mov    %cr4,%eax
  orl     $(CR4_PSE), %eax
8010000f:	83 c8 10             	or     $0x10,%eax
  movl    %eax, %cr4
80100012:	0f 22 e0             	mov    %eax,%cr4
  # Set page directory
  movl    $(V2P_WO(entrypgdir)), %eax
80100015:	b8 00 b0 10 00       	mov    $0x10b000,%eax
  movl    %eax, %cr3
8010001a:	0f 22 d8             	mov    %eax,%cr3
  # Turn on paging.
  movl    %cr0, %eax
8010001d:	0f 20 c0             	mov    %cr0,%eax
  orl     $(CR0_PG|CR0_WP), %eax
80100020:	0d 00 00 01 80       	or     $0x80010000,%eax
  movl    %eax, %cr0
80100025:	0f 22 c0             	mov    %eax,%cr0

  # Set up the stack pointer.
  movl $(stack + KSTACKSIZE), %esp
80100028:	bc c0 d6 10 80       	mov    $0x8010d6c0,%esp

  # Jump to main(), and switch to executing at
  # high addresses. The indirect call is needed because
  # the assembler produces a PC-relative instruction
  # for a direct jump.
  mov $main, %eax
8010002d:	b8 7b 34 10 80       	mov    $0x8010347b,%eax
  jmp *%eax
80100032:	ff e0                	jmp    *%eax

80100034 <binit>:
  struct buf head;
} bcache;

void
binit(void)
{
80100034:	55                   	push   %ebp
80100035:	89 e5                	mov    %esp,%ebp
80100037:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  initlock(&bcache.lock, "bcache");
8010003a:	c7 44 24 04 2c 93 10 	movl   $0x8010932c,0x4(%esp)
80100041:	80 
80100042:	c7 04 24 c0 d6 10 80 	movl   $0x8010d6c0,(%esp)
80100049:	e8 98 5b 00 00       	call   80105be6 <initlock>

//PAGEBREAK!
  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
8010004e:	c7 05 f0 eb 10 80 e4 	movl   $0x8010ebe4,0x8010ebf0
80100055:	eb 10 80 
  bcache.head.next = &bcache.head;
80100058:	c7 05 f4 eb 10 80 e4 	movl   $0x8010ebe4,0x8010ebf4
8010005f:	eb 10 80 
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100062:	c7 45 f4 f4 d6 10 80 	movl   $0x8010d6f4,-0xc(%ebp)
80100069:	eb 3a                	jmp    801000a5 <binit+0x71>
    b->next = bcache.head.next;
8010006b:	8b 15 f4 eb 10 80    	mov    0x8010ebf4,%edx
80100071:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100074:	89 50 10             	mov    %edx,0x10(%eax)
    b->prev = &bcache.head;
80100077:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010007a:	c7 40 0c e4 eb 10 80 	movl   $0x8010ebe4,0xc(%eax)
    b->dev = -1;
80100081:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100084:	c7 40 04 ff ff ff ff 	movl   $0xffffffff,0x4(%eax)
    bcache.head.next->prev = b;
8010008b:	a1 f4 eb 10 80       	mov    0x8010ebf4,%eax
80100090:	8b 55 f4             	mov    -0xc(%ebp),%edx
80100093:	89 50 0c             	mov    %edx,0xc(%eax)
    bcache.head.next = b;
80100096:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100099:	a3 f4 eb 10 80       	mov    %eax,0x8010ebf4

//PAGEBREAK!
  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
  bcache.head.next = &bcache.head;
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
8010009e:	81 45 f4 18 02 00 00 	addl   $0x218,-0xc(%ebp)
801000a5:	81 7d f4 e4 eb 10 80 	cmpl   $0x8010ebe4,-0xc(%ebp)
801000ac:	72 bd                	jb     8010006b <binit+0x37>
    b->prev = &bcache.head;
    b->dev = -1;
    bcache.head.next->prev = b;
    bcache.head.next = b;
  }
}
801000ae:	c9                   	leave  
801000af:	c3                   	ret    

801000b0 <bget>:
// Look through buffer cache for sector on device dev.
// If not found, allocate fresh block.
// In either case, return B_BUSY buffer.
static struct buf*
bget(uint dev, uint sector)
{
801000b0:	55                   	push   %ebp
801000b1:	89 e5                	mov    %esp,%ebp
801000b3:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  acquire(&bcache.lock);
801000b6:	c7 04 24 c0 d6 10 80 	movl   $0x8010d6c0,(%esp)
801000bd:	e8 45 5b 00 00       	call   80105c07 <acquire>
801000c2:	eb 01                	jmp    801000c5 <bget+0x15>
        b->flags |= B_BUSY;
        release(&bcache.lock);
        return b;
      }
//      sleep(b, &bcache.lock);
      goto loop;
801000c4:	90                   	nop

  acquire(&bcache.lock);

 loop:
  // Is the sector already cached?
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000c5:	a1 f4 eb 10 80       	mov    0x8010ebf4,%eax
801000ca:	89 45 f4             	mov    %eax,-0xc(%ebp)
801000cd:	eb 4b                	jmp    8010011a <bget+0x6a>
    if(b->dev == dev && b->sector == sector){
801000cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000d2:	8b 40 04             	mov    0x4(%eax),%eax
801000d5:	3b 45 08             	cmp    0x8(%ebp),%eax
801000d8:	75 37                	jne    80100111 <bget+0x61>
801000da:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000dd:	8b 40 08             	mov    0x8(%eax),%eax
801000e0:	3b 45 0c             	cmp    0xc(%ebp),%eax
801000e3:	75 2c                	jne    80100111 <bget+0x61>
      if(!(b->flags & B_BUSY)){
801000e5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000e8:	8b 00                	mov    (%eax),%eax
801000ea:	83 e0 01             	and    $0x1,%eax
801000ed:	85 c0                	test   %eax,%eax
801000ef:	75 d3                	jne    801000c4 <bget+0x14>
        b->flags |= B_BUSY;
801000f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000f4:	8b 00                	mov    (%eax),%eax
801000f6:	89 c2                	mov    %eax,%edx
801000f8:	83 ca 01             	or     $0x1,%edx
801000fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000fe:	89 10                	mov    %edx,(%eax)
        release(&bcache.lock);
80100100:	c7 04 24 c0 d6 10 80 	movl   $0x8010d6c0,(%esp)
80100107:	e8 5d 5b 00 00       	call   80105c69 <release>
        return b;
8010010c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010010f:	eb 7e                	jmp    8010018f <bget+0xdf>

  acquire(&bcache.lock);

 loop:
  // Is the sector already cached?
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
80100111:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100114:	8b 40 10             	mov    0x10(%eax),%eax
80100117:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010011a:	81 7d f4 e4 eb 10 80 	cmpl   $0x8010ebe4,-0xc(%ebp)
80100121:	75 ac                	jne    801000cf <bget+0x1f>
      goto loop;
    }
  }

  // Not cached; recycle some non-busy and clean buffer.
  for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100123:	a1 f0 eb 10 80       	mov    0x8010ebf0,%eax
80100128:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010012b:	eb 4d                	jmp    8010017a <bget+0xca>
    if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){
8010012d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100130:	8b 00                	mov    (%eax),%eax
80100132:	83 e0 01             	and    $0x1,%eax
80100135:	85 c0                	test   %eax,%eax
80100137:	75 38                	jne    80100171 <bget+0xc1>
80100139:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010013c:	8b 00                	mov    (%eax),%eax
8010013e:	83 e0 04             	and    $0x4,%eax
80100141:	85 c0                	test   %eax,%eax
80100143:	75 2c                	jne    80100171 <bget+0xc1>
      b->dev = dev;
80100145:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100148:	8b 55 08             	mov    0x8(%ebp),%edx
8010014b:	89 50 04             	mov    %edx,0x4(%eax)
      b->sector = sector;
8010014e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100151:	8b 55 0c             	mov    0xc(%ebp),%edx
80100154:	89 50 08             	mov    %edx,0x8(%eax)
      b->flags = B_BUSY;
80100157:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010015a:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
      release(&bcache.lock);
80100160:	c7 04 24 c0 d6 10 80 	movl   $0x8010d6c0,(%esp)
80100167:	e8 fd 5a 00 00       	call   80105c69 <release>
      return b;
8010016c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010016f:	eb 1e                	jmp    8010018f <bget+0xdf>
      goto loop;
    }
  }

  // Not cached; recycle some non-busy and clean buffer.
  for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100171:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100174:	8b 40 0c             	mov    0xc(%eax),%eax
80100177:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010017a:	81 7d f4 e4 eb 10 80 	cmpl   $0x8010ebe4,-0xc(%ebp)
80100181:	75 aa                	jne    8010012d <bget+0x7d>
      b->flags = B_BUSY;
      release(&bcache.lock);
      return b;
    }
  }
  panic("bget: no buffers");
80100183:	c7 04 24 33 93 10 80 	movl   $0x80109333,(%esp)
8010018a:	e8 a3 03 00 00       	call   80100532 <panic>
}
8010018f:	c9                   	leave  
80100190:	c3                   	ret    

80100191 <bread>:

// Return a B_BUSY buf with the contents of the indicated disk sector.
struct buf*
bread(uint dev, uint sector)
{
80100191:	55                   	push   %ebp
80100192:	89 e5                	mov    %esp,%ebp
80100194:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  b = bget(dev, sector);
80100197:	8b 45 0c             	mov    0xc(%ebp),%eax
8010019a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010019e:	8b 45 08             	mov    0x8(%ebp),%eax
801001a1:	89 04 24             	mov    %eax,(%esp)
801001a4:	e8 07 ff ff ff       	call   801000b0 <bget>
801001a9:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(!(b->flags & B_VALID))
801001ac:	8b 45 f4             	mov    -0xc(%ebp),%eax
801001af:	8b 00                	mov    (%eax),%eax
801001b1:	83 e0 02             	and    $0x2,%eax
801001b4:	85 c0                	test   %eax,%eax
801001b6:	75 0b                	jne    801001c3 <bread+0x32>
    iderw(b);
801001b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801001bb:	89 04 24             	mov    %eax,(%esp)
801001be:	e8 10 26 00 00       	call   801027d3 <iderw>
  return b;
801001c3:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
801001c6:	c9                   	leave  
801001c7:	c3                   	ret    

801001c8 <bwrite>:

// Write b's contents to disk.  Must be B_BUSY.
void
bwrite(struct buf *b)
{
801001c8:	55                   	push   %ebp
801001c9:	89 e5                	mov    %esp,%ebp
801001cb:	83 ec 18             	sub    $0x18,%esp
  if((b->flags & B_BUSY) == 0)
801001ce:	8b 45 08             	mov    0x8(%ebp),%eax
801001d1:	8b 00                	mov    (%eax),%eax
801001d3:	83 e0 01             	and    $0x1,%eax
801001d6:	85 c0                	test   %eax,%eax
801001d8:	75 0c                	jne    801001e6 <bwrite+0x1e>
    panic("bwrite");
801001da:	c7 04 24 44 93 10 80 	movl   $0x80109344,(%esp)
801001e1:	e8 4c 03 00 00       	call   80100532 <panic>
  b->flags |= B_DIRTY;
801001e6:	8b 45 08             	mov    0x8(%ebp),%eax
801001e9:	8b 00                	mov    (%eax),%eax
801001eb:	89 c2                	mov    %eax,%edx
801001ed:	83 ca 04             	or     $0x4,%edx
801001f0:	8b 45 08             	mov    0x8(%ebp),%eax
801001f3:	89 10                	mov    %edx,(%eax)
  iderw(b);
801001f5:	8b 45 08             	mov    0x8(%ebp),%eax
801001f8:	89 04 24             	mov    %eax,(%esp)
801001fb:	e8 d3 25 00 00       	call   801027d3 <iderw>
}
80100200:	c9                   	leave  
80100201:	c3                   	ret    

80100202 <brelse>:

// Release a B_BUSY buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
80100202:	55                   	push   %ebp
80100203:	89 e5                	mov    %esp,%ebp
80100205:	83 ec 18             	sub    $0x18,%esp
  if((b->flags & B_BUSY) == 0)
80100208:	8b 45 08             	mov    0x8(%ebp),%eax
8010020b:	8b 00                	mov    (%eax),%eax
8010020d:	83 e0 01             	and    $0x1,%eax
80100210:	85 c0                	test   %eax,%eax
80100212:	75 0c                	jne    80100220 <brelse+0x1e>
    panic("brelse");
80100214:	c7 04 24 4b 93 10 80 	movl   $0x8010934b,(%esp)
8010021b:	e8 12 03 00 00       	call   80100532 <panic>

  acquire(&bcache.lock);
80100220:	c7 04 24 c0 d6 10 80 	movl   $0x8010d6c0,(%esp)
80100227:	e8 db 59 00 00       	call   80105c07 <acquire>

  b->next->prev = b->prev;
8010022c:	8b 45 08             	mov    0x8(%ebp),%eax
8010022f:	8b 40 10             	mov    0x10(%eax),%eax
80100232:	8b 55 08             	mov    0x8(%ebp),%edx
80100235:	8b 52 0c             	mov    0xc(%edx),%edx
80100238:	89 50 0c             	mov    %edx,0xc(%eax)
  b->prev->next = b->next;
8010023b:	8b 45 08             	mov    0x8(%ebp),%eax
8010023e:	8b 40 0c             	mov    0xc(%eax),%eax
80100241:	8b 55 08             	mov    0x8(%ebp),%edx
80100244:	8b 52 10             	mov    0x10(%edx),%edx
80100247:	89 50 10             	mov    %edx,0x10(%eax)
  b->next = bcache.head.next;
8010024a:	8b 15 f4 eb 10 80    	mov    0x8010ebf4,%edx
80100250:	8b 45 08             	mov    0x8(%ebp),%eax
80100253:	89 50 10             	mov    %edx,0x10(%eax)
  b->prev = &bcache.head;
80100256:	8b 45 08             	mov    0x8(%ebp),%eax
80100259:	c7 40 0c e4 eb 10 80 	movl   $0x8010ebe4,0xc(%eax)
  bcache.head.next->prev = b;
80100260:	a1 f4 eb 10 80       	mov    0x8010ebf4,%eax
80100265:	8b 55 08             	mov    0x8(%ebp),%edx
80100268:	89 50 0c             	mov    %edx,0xc(%eax)
  bcache.head.next = b;
8010026b:	8b 45 08             	mov    0x8(%ebp),%eax
8010026e:	a3 f4 eb 10 80       	mov    %eax,0x8010ebf4

  b->flags &= ~B_BUSY;
80100273:	8b 45 08             	mov    0x8(%ebp),%eax
80100276:	8b 00                	mov    (%eax),%eax
80100278:	89 c2                	mov    %eax,%edx
8010027a:	83 e2 fe             	and    $0xfffffffe,%edx
8010027d:	8b 45 08             	mov    0x8(%ebp),%eax
80100280:	89 10                	mov    %edx,(%eax)
  wakeup(b);
80100282:	8b 45 08             	mov    0x8(%ebp),%eax
80100285:	89 04 24             	mov    %eax,(%esp)
80100288:	e8 88 48 00 00       	call   80104b15 <wakeup>

  release(&bcache.lock);
8010028d:	c7 04 24 c0 d6 10 80 	movl   $0x8010d6c0,(%esp)
80100294:	e8 d0 59 00 00       	call   80105c69 <release>
}
80100299:	c9                   	leave  
8010029a:	c3                   	ret    
8010029b:	90                   	nop

8010029c <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
8010029c:	55                   	push   %ebp
8010029d:	89 e5                	mov    %esp,%ebp
8010029f:	53                   	push   %ebx
801002a0:	83 ec 14             	sub    $0x14,%esp
801002a3:	8b 45 08             	mov    0x8(%ebp),%eax
801002a6:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801002aa:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
801002ae:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
801002b2:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
801002b6:	ec                   	in     (%dx),%al
801002b7:	89 c3                	mov    %eax,%ebx
801002b9:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
801002bc:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
801002c0:	83 c4 14             	add    $0x14,%esp
801002c3:	5b                   	pop    %ebx
801002c4:	5d                   	pop    %ebp
801002c5:	c3                   	ret    

801002c6 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
801002c6:	55                   	push   %ebp
801002c7:	89 e5                	mov    %esp,%ebp
801002c9:	83 ec 08             	sub    $0x8,%esp
801002cc:	8b 55 08             	mov    0x8(%ebp),%edx
801002cf:	8b 45 0c             	mov    0xc(%ebp),%eax
801002d2:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
801002d6:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
801002d9:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
801002dd:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
801002e1:	ee                   	out    %al,(%dx)
}
801002e2:	c9                   	leave  
801002e3:	c3                   	ret    

801002e4 <cli>:
  asm volatile("movw %0, %%gs" : : "r" (v));
}

static inline void
cli(void)
{
801002e4:	55                   	push   %ebp
801002e5:	89 e5                	mov    %esp,%ebp
  asm volatile("cli");
801002e7:	fa                   	cli    
}
801002e8:	5d                   	pop    %ebp
801002e9:	c3                   	ret    

801002ea <printint>:
  int locking;
} cons;

static void
printint(int xx, int base, int sign)
{
801002ea:	55                   	push   %ebp
801002eb:	89 e5                	mov    %esp,%ebp
801002ed:	83 ec 48             	sub    $0x48,%esp
  static char digits[] = "0123456789abcdef";
  char buf[16];
  int i;
  uint x;

  if(sign && (sign = xx < 0))
801002f0:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801002f4:	74 1c                	je     80100312 <printint+0x28>
801002f6:	8b 45 08             	mov    0x8(%ebp),%eax
801002f9:	c1 e8 1f             	shr    $0x1f,%eax
801002fc:	0f b6 c0             	movzbl %al,%eax
801002ff:	89 45 10             	mov    %eax,0x10(%ebp)
80100302:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100306:	74 0a                	je     80100312 <printint+0x28>
    x = -xx;
80100308:	8b 45 08             	mov    0x8(%ebp),%eax
8010030b:	f7 d8                	neg    %eax
8010030d:	89 45 f0             	mov    %eax,-0x10(%ebp)
80100310:	eb 06                	jmp    80100318 <printint+0x2e>
  else
    x = xx;
80100312:	8b 45 08             	mov    0x8(%ebp),%eax
80100315:	89 45 f0             	mov    %eax,-0x10(%ebp)

  i = 0;
80100318:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  do{
    buf[i++] = digits[x % base];
8010031f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
80100322:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100325:	ba 00 00 00 00       	mov    $0x0,%edx
8010032a:	f7 f1                	div    %ecx
8010032c:	89 d0                	mov    %edx,%eax
8010032e:	0f b6 80 04 a0 10 80 	movzbl -0x7fef5ffc(%eax),%eax
80100335:	8d 4d e0             	lea    -0x20(%ebp),%ecx
80100338:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010033b:	01 ca                	add    %ecx,%edx
8010033d:	88 02                	mov    %al,(%edx)
8010033f:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
  }while((x /= base) != 0);
80100343:	8b 55 0c             	mov    0xc(%ebp),%edx
80100346:	89 55 d4             	mov    %edx,-0x2c(%ebp)
80100349:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010034c:	ba 00 00 00 00       	mov    $0x0,%edx
80100351:	f7 75 d4             	divl   -0x2c(%ebp)
80100354:	89 45 f0             	mov    %eax,-0x10(%ebp)
80100357:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010035b:	75 c2                	jne    8010031f <printint+0x35>

  if(sign)
8010035d:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100361:	74 27                	je     8010038a <printint+0xa0>
    buf[i++] = '-';
80100363:	8d 55 e0             	lea    -0x20(%ebp),%edx
80100366:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100369:	01 d0                	add    %edx,%eax
8010036b:	c6 00 2d             	movb   $0x2d,(%eax)
8010036e:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)

  while(--i >= 0)
80100372:	eb 16                	jmp    8010038a <printint+0xa0>
    consputc(buf[i]);
80100374:	8d 55 e0             	lea    -0x20(%ebp),%edx
80100377:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010037a:	01 d0                	add    %edx,%eax
8010037c:	0f b6 00             	movzbl (%eax),%eax
8010037f:	0f be c0             	movsbl %al,%eax
80100382:	89 04 24             	mov    %eax,(%esp)
80100385:	e8 bb 03 00 00       	call   80100745 <consputc>
  }while((x /= base) != 0);

  if(sign)
    buf[i++] = '-';

  while(--i >= 0)
8010038a:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
8010038e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80100392:	79 e0                	jns    80100374 <printint+0x8a>
    consputc(buf[i]);
}
80100394:	c9                   	leave  
80100395:	c3                   	ret    

80100396 <cprintf>:
//PAGEBREAK: 50

// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
80100396:	55                   	push   %ebp
80100397:	89 e5                	mov    %esp,%ebp
80100399:	83 ec 38             	sub    $0x38,%esp
  int i, c, locking;
  uint *argp;
  char *s;

  locking = cons.locking;
8010039c:	a1 54 c6 10 80       	mov    0x8010c654,%eax
801003a1:	89 45 e8             	mov    %eax,-0x18(%ebp)
  if(locking)
801003a4:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801003a8:	74 0c                	je     801003b6 <cprintf+0x20>
    acquire(&cons.lock);
801003aa:	c7 04 24 20 c6 10 80 	movl   $0x8010c620,(%esp)
801003b1:	e8 51 58 00 00       	call   80105c07 <acquire>

  if (fmt == 0)
801003b6:	8b 45 08             	mov    0x8(%ebp),%eax
801003b9:	85 c0                	test   %eax,%eax
801003bb:	75 0c                	jne    801003c9 <cprintf+0x33>
    panic("null fmt");
801003bd:	c7 04 24 52 93 10 80 	movl   $0x80109352,(%esp)
801003c4:	e8 69 01 00 00       	call   80100532 <panic>

  argp = (uint*)(void*)(&fmt + 1);
801003c9:	8d 45 0c             	lea    0xc(%ebp),%eax
801003cc:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801003cf:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801003d6:	e9 20 01 00 00       	jmp    801004fb <cprintf+0x165>
    if(c != '%'){
801003db:	83 7d e4 25          	cmpl   $0x25,-0x1c(%ebp)
801003df:	74 10                	je     801003f1 <cprintf+0x5b>
      consputc(c);
801003e1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801003e4:	89 04 24             	mov    %eax,(%esp)
801003e7:	e8 59 03 00 00       	call   80100745 <consputc>
      continue;
801003ec:	e9 06 01 00 00       	jmp    801004f7 <cprintf+0x161>
    }
    c = fmt[++i] & 0xff;
801003f1:	8b 55 08             	mov    0x8(%ebp),%edx
801003f4:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801003f8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801003fb:	01 d0                	add    %edx,%eax
801003fd:	0f b6 00             	movzbl (%eax),%eax
80100400:	0f be c0             	movsbl %al,%eax
80100403:	25 ff 00 00 00       	and    $0xff,%eax
80100408:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    if(c == 0)
8010040b:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
8010040f:	0f 84 08 01 00 00    	je     8010051d <cprintf+0x187>
      break;
    switch(c){
80100415:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100418:	83 f8 70             	cmp    $0x70,%eax
8010041b:	74 4d                	je     8010046a <cprintf+0xd4>
8010041d:	83 f8 70             	cmp    $0x70,%eax
80100420:	7f 13                	jg     80100435 <cprintf+0x9f>
80100422:	83 f8 25             	cmp    $0x25,%eax
80100425:	0f 84 a6 00 00 00    	je     801004d1 <cprintf+0x13b>
8010042b:	83 f8 64             	cmp    $0x64,%eax
8010042e:	74 14                	je     80100444 <cprintf+0xae>
80100430:	e9 aa 00 00 00       	jmp    801004df <cprintf+0x149>
80100435:	83 f8 73             	cmp    $0x73,%eax
80100438:	74 53                	je     8010048d <cprintf+0xf7>
8010043a:	83 f8 78             	cmp    $0x78,%eax
8010043d:	74 2b                	je     8010046a <cprintf+0xd4>
8010043f:	e9 9b 00 00 00       	jmp    801004df <cprintf+0x149>
    case 'd':
      printint(*argp++, 10, 1);
80100444:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100447:	8b 00                	mov    (%eax),%eax
80100449:	83 45 f0 04          	addl   $0x4,-0x10(%ebp)
8010044d:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
80100454:	00 
80100455:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
8010045c:	00 
8010045d:	89 04 24             	mov    %eax,(%esp)
80100460:	e8 85 fe ff ff       	call   801002ea <printint>
      break;
80100465:	e9 8d 00 00 00       	jmp    801004f7 <cprintf+0x161>
    case 'x':
    case 'p':
      printint(*argp++, 16, 0);
8010046a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010046d:	8b 00                	mov    (%eax),%eax
8010046f:	83 45 f0 04          	addl   $0x4,-0x10(%ebp)
80100473:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
8010047a:	00 
8010047b:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
80100482:	00 
80100483:	89 04 24             	mov    %eax,(%esp)
80100486:	e8 5f fe ff ff       	call   801002ea <printint>
      break;
8010048b:	eb 6a                	jmp    801004f7 <cprintf+0x161>
    case 's':
      if((s = (char*)*argp++) == 0)
8010048d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100490:	8b 00                	mov    (%eax),%eax
80100492:	89 45 ec             	mov    %eax,-0x14(%ebp)
80100495:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80100499:	0f 94 c0             	sete   %al
8010049c:	83 45 f0 04          	addl   $0x4,-0x10(%ebp)
801004a0:	84 c0                	test   %al,%al
801004a2:	74 20                	je     801004c4 <cprintf+0x12e>
        s = "(null)";
801004a4:	c7 45 ec 5b 93 10 80 	movl   $0x8010935b,-0x14(%ebp)
      for(; *s; s++)
801004ab:	eb 17                	jmp    801004c4 <cprintf+0x12e>
        consputc(*s);
801004ad:	8b 45 ec             	mov    -0x14(%ebp),%eax
801004b0:	0f b6 00             	movzbl (%eax),%eax
801004b3:	0f be c0             	movsbl %al,%eax
801004b6:	89 04 24             	mov    %eax,(%esp)
801004b9:	e8 87 02 00 00       	call   80100745 <consputc>
      printint(*argp++, 16, 0);
      break;
    case 's':
      if((s = (char*)*argp++) == 0)
        s = "(null)";
      for(; *s; s++)
801004be:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
801004c2:	eb 01                	jmp    801004c5 <cprintf+0x12f>
801004c4:	90                   	nop
801004c5:	8b 45 ec             	mov    -0x14(%ebp),%eax
801004c8:	0f b6 00             	movzbl (%eax),%eax
801004cb:	84 c0                	test   %al,%al
801004cd:	75 de                	jne    801004ad <cprintf+0x117>
        consputc(*s);
      break;
801004cf:	eb 26                	jmp    801004f7 <cprintf+0x161>
    case '%':
      consputc('%');
801004d1:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
801004d8:	e8 68 02 00 00       	call   80100745 <consputc>
      break;
801004dd:	eb 18                	jmp    801004f7 <cprintf+0x161>
    default:
      // Print unknown % sequence to draw attention.
      consputc('%');
801004df:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
801004e6:	e8 5a 02 00 00       	call   80100745 <consputc>
      consputc(c);
801004eb:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801004ee:	89 04 24             	mov    %eax,(%esp)
801004f1:	e8 4f 02 00 00       	call   80100745 <consputc>
      break;
801004f6:	90                   	nop

  if (fmt == 0)
    panic("null fmt");

  argp = (uint*)(void*)(&fmt + 1);
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801004f7:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801004fb:	8b 55 08             	mov    0x8(%ebp),%edx
801004fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100501:	01 d0                	add    %edx,%eax
80100503:	0f b6 00             	movzbl (%eax),%eax
80100506:	0f be c0             	movsbl %al,%eax
80100509:	25 ff 00 00 00       	and    $0xff,%eax
8010050e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
80100511:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
80100515:	0f 85 c0 fe ff ff    	jne    801003db <cprintf+0x45>
8010051b:	eb 01                	jmp    8010051e <cprintf+0x188>
      consputc(c);
      continue;
    }
    c = fmt[++i] & 0xff;
    if(c == 0)
      break;
8010051d:	90                   	nop
      consputc(c);
      break;
    }
  }

  if(locking)
8010051e:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
80100522:	74 0c                	je     80100530 <cprintf+0x19a>
    release(&cons.lock);
80100524:	c7 04 24 20 c6 10 80 	movl   $0x8010c620,(%esp)
8010052b:	e8 39 57 00 00       	call   80105c69 <release>
}
80100530:	c9                   	leave  
80100531:	c3                   	ret    

80100532 <panic>:

void
panic(char *s)
{
80100532:	55                   	push   %ebp
80100533:	89 e5                	mov    %esp,%ebp
80100535:	83 ec 48             	sub    $0x48,%esp
  int i;
  uint pcs[10];
  
  cli();
80100538:	e8 a7 fd ff ff       	call   801002e4 <cli>
  cons.locking = 0;
8010053d:	c7 05 54 c6 10 80 00 	movl   $0x0,0x8010c654
80100544:	00 00 00 
  cprintf("cpu%d: panic: ", cpu->id);
80100547:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010054d:	0f b6 00             	movzbl (%eax),%eax
80100550:	0f b6 c0             	movzbl %al,%eax
80100553:	89 44 24 04          	mov    %eax,0x4(%esp)
80100557:	c7 04 24 62 93 10 80 	movl   $0x80109362,(%esp)
8010055e:	e8 33 fe ff ff       	call   80100396 <cprintf>
  cprintf(s);
80100563:	8b 45 08             	mov    0x8(%ebp),%eax
80100566:	89 04 24             	mov    %eax,(%esp)
80100569:	e8 28 fe ff ff       	call   80100396 <cprintf>
  cprintf("\n");
8010056e:	c7 04 24 71 93 10 80 	movl   $0x80109371,(%esp)
80100575:	e8 1c fe ff ff       	call   80100396 <cprintf>
  getcallerpcs(&s, pcs);
8010057a:	8d 45 cc             	lea    -0x34(%ebp),%eax
8010057d:	89 44 24 04          	mov    %eax,0x4(%esp)
80100581:	8d 45 08             	lea    0x8(%ebp),%eax
80100584:	89 04 24             	mov    %eax,(%esp)
80100587:	e8 2c 57 00 00       	call   80105cb8 <getcallerpcs>
  for(i=0; i<10; i++)
8010058c:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80100593:	eb 1b                	jmp    801005b0 <panic+0x7e>
    cprintf(" %p", pcs[i]);
80100595:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100598:	8b 44 85 cc          	mov    -0x34(%ebp,%eax,4),%eax
8010059c:	89 44 24 04          	mov    %eax,0x4(%esp)
801005a0:	c7 04 24 73 93 10 80 	movl   $0x80109373,(%esp)
801005a7:	e8 ea fd ff ff       	call   80100396 <cprintf>
  cons.locking = 0;
  cprintf("cpu%d: panic: ", cpu->id);
  cprintf(s);
  cprintf("\n");
  getcallerpcs(&s, pcs);
  for(i=0; i<10; i++)
801005ac:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801005b0:	83 7d f4 09          	cmpl   $0x9,-0xc(%ebp)
801005b4:	7e df                	jle    80100595 <panic+0x63>
    cprintf(" %p", pcs[i]);
  panicked = 1; // freeze other CPU
801005b6:	c7 05 00 c6 10 80 01 	movl   $0x1,0x8010c600
801005bd:	00 00 00 
  for(;;)
    ;
801005c0:	eb fe                	jmp    801005c0 <panic+0x8e>

801005c2 <cgaputc>:
#define CRTPORT 0x3d4
static ushort *crt = (ushort*)P2V(0xb8000);  // CGA memory

static void
cgaputc(int c)
{
801005c2:	55                   	push   %ebp
801005c3:	89 e5                	mov    %esp,%ebp
801005c5:	83 ec 28             	sub    $0x28,%esp
  int pos;
  
  // Cursor position: col + 80*row.
  outb(CRTPORT, 14);
801005c8:	c7 44 24 04 0e 00 00 	movl   $0xe,0x4(%esp)
801005cf:	00 
801005d0:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
801005d7:	e8 ea fc ff ff       	call   801002c6 <outb>
  pos = inb(CRTPORT+1) << 8;
801005dc:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
801005e3:	e8 b4 fc ff ff       	call   8010029c <inb>
801005e8:	0f b6 c0             	movzbl %al,%eax
801005eb:	c1 e0 08             	shl    $0x8,%eax
801005ee:	89 45 f4             	mov    %eax,-0xc(%ebp)
  outb(CRTPORT, 15);
801005f1:	c7 44 24 04 0f 00 00 	movl   $0xf,0x4(%esp)
801005f8:	00 
801005f9:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
80100600:	e8 c1 fc ff ff       	call   801002c6 <outb>
  pos |= inb(CRTPORT+1);
80100605:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
8010060c:	e8 8b fc ff ff       	call   8010029c <inb>
80100611:	0f b6 c0             	movzbl %al,%eax
80100614:	09 45 f4             	or     %eax,-0xc(%ebp)

  if(c == '\n')
80100617:	83 7d 08 0a          	cmpl   $0xa,0x8(%ebp)
8010061b:	75 30                	jne    8010064d <cgaputc+0x8b>
    pos += 80 - pos%80;
8010061d:	8b 4d f4             	mov    -0xc(%ebp),%ecx
80100620:	ba 67 66 66 66       	mov    $0x66666667,%edx
80100625:	89 c8                	mov    %ecx,%eax
80100627:	f7 ea                	imul   %edx
80100629:	c1 fa 05             	sar    $0x5,%edx
8010062c:	89 c8                	mov    %ecx,%eax
8010062e:	c1 f8 1f             	sar    $0x1f,%eax
80100631:	29 c2                	sub    %eax,%edx
80100633:	89 d0                	mov    %edx,%eax
80100635:	c1 e0 02             	shl    $0x2,%eax
80100638:	01 d0                	add    %edx,%eax
8010063a:	c1 e0 04             	shl    $0x4,%eax
8010063d:	89 ca                	mov    %ecx,%edx
8010063f:	29 c2                	sub    %eax,%edx
80100641:	b8 50 00 00 00       	mov    $0x50,%eax
80100646:	29 d0                	sub    %edx,%eax
80100648:	01 45 f4             	add    %eax,-0xc(%ebp)
8010064b:	eb 32                	jmp    8010067f <cgaputc+0xbd>
  else if(c == BACKSPACE){
8010064d:	81 7d 08 00 01 00 00 	cmpl   $0x100,0x8(%ebp)
80100654:	75 0c                	jne    80100662 <cgaputc+0xa0>
    if(pos > 0) --pos;
80100656:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010065a:	7e 23                	jle    8010067f <cgaputc+0xbd>
8010065c:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
80100660:	eb 1d                	jmp    8010067f <cgaputc+0xbd>
  } else
    crt[pos++] = (c&0xff) | 0x0700;  // black on white
80100662:	a1 00 a0 10 80       	mov    0x8010a000,%eax
80100667:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010066a:	01 d2                	add    %edx,%edx
8010066c:	01 c2                	add    %eax,%edx
8010066e:	8b 45 08             	mov    0x8(%ebp),%eax
80100671:	66 25 ff 00          	and    $0xff,%ax
80100675:	80 cc 07             	or     $0x7,%ah
80100678:	66 89 02             	mov    %ax,(%edx)
8010067b:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
  
  if((pos/80) >= 24){  // Scroll up.
8010067f:	81 7d f4 7f 07 00 00 	cmpl   $0x77f,-0xc(%ebp)
80100686:	7e 53                	jle    801006db <cgaputc+0x119>
    memmove(crt, crt+80, sizeof(crt[0])*23*80);
80100688:	a1 00 a0 10 80       	mov    0x8010a000,%eax
8010068d:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
80100693:	a1 00 a0 10 80       	mov    0x8010a000,%eax
80100698:	c7 44 24 08 60 0e 00 	movl   $0xe60,0x8(%esp)
8010069f:	00 
801006a0:	89 54 24 04          	mov    %edx,0x4(%esp)
801006a4:	89 04 24             	mov    %eax,(%esp)
801006a7:	e8 89 58 00 00       	call   80105f35 <memmove>
    pos -= 80;
801006ac:	83 6d f4 50          	subl   $0x50,-0xc(%ebp)
    memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
801006b0:	b8 80 07 00 00       	mov    $0x780,%eax
801006b5:	2b 45 f4             	sub    -0xc(%ebp),%eax
801006b8:	01 c0                	add    %eax,%eax
801006ba:	8b 15 00 a0 10 80    	mov    0x8010a000,%edx
801006c0:	8b 4d f4             	mov    -0xc(%ebp),%ecx
801006c3:	01 c9                	add    %ecx,%ecx
801006c5:	01 ca                	add    %ecx,%edx
801006c7:	89 44 24 08          	mov    %eax,0x8(%esp)
801006cb:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801006d2:	00 
801006d3:	89 14 24             	mov    %edx,(%esp)
801006d6:	e8 87 57 00 00       	call   80105e62 <memset>
  }
  
  outb(CRTPORT, 14);
801006db:	c7 44 24 04 0e 00 00 	movl   $0xe,0x4(%esp)
801006e2:	00 
801006e3:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
801006ea:	e8 d7 fb ff ff       	call   801002c6 <outb>
  outb(CRTPORT+1, pos>>8);
801006ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
801006f2:	c1 f8 08             	sar    $0x8,%eax
801006f5:	0f b6 c0             	movzbl %al,%eax
801006f8:	89 44 24 04          	mov    %eax,0x4(%esp)
801006fc:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
80100703:	e8 be fb ff ff       	call   801002c6 <outb>
  outb(CRTPORT, 15);
80100708:	c7 44 24 04 0f 00 00 	movl   $0xf,0x4(%esp)
8010070f:	00 
80100710:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
80100717:	e8 aa fb ff ff       	call   801002c6 <outb>
  outb(CRTPORT+1, pos);
8010071c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010071f:	0f b6 c0             	movzbl %al,%eax
80100722:	89 44 24 04          	mov    %eax,0x4(%esp)
80100726:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
8010072d:	e8 94 fb ff ff       	call   801002c6 <outb>
  crt[pos] = ' ' | 0x0700;
80100732:	a1 00 a0 10 80       	mov    0x8010a000,%eax
80100737:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010073a:	01 d2                	add    %edx,%edx
8010073c:	01 d0                	add    %edx,%eax
8010073e:	66 c7 00 20 07       	movw   $0x720,(%eax)
}
80100743:	c9                   	leave  
80100744:	c3                   	ret    

80100745 <consputc>:

void
consputc(int c)
{
80100745:	55                   	push   %ebp
80100746:	89 e5                	mov    %esp,%ebp
80100748:	83 ec 18             	sub    $0x18,%esp
  if(panicked){
8010074b:	a1 00 c6 10 80       	mov    0x8010c600,%eax
80100750:	85 c0                	test   %eax,%eax
80100752:	74 07                	je     8010075b <consputc+0x16>
    cli();
80100754:	e8 8b fb ff ff       	call   801002e4 <cli>
    for(;;)
      ;
80100759:	eb fe                	jmp    80100759 <consputc+0x14>
  }

  if(c == BACKSPACE){
8010075b:	81 7d 08 00 01 00 00 	cmpl   $0x100,0x8(%ebp)
80100762:	75 26                	jne    8010078a <consputc+0x45>
    uartputc('\b'); uartputc(' '); uartputc('\b');
80100764:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
8010076b:	e8 09 72 00 00       	call   80107979 <uartputc>
80100770:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80100777:	e8 fd 71 00 00       	call   80107979 <uartputc>
8010077c:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
80100783:	e8 f1 71 00 00       	call   80107979 <uartputc>
80100788:	eb 0b                	jmp    80100795 <consputc+0x50>
  } else
    uartputc(c);
8010078a:	8b 45 08             	mov    0x8(%ebp),%eax
8010078d:	89 04 24             	mov    %eax,(%esp)
80100790:	e8 e4 71 00 00       	call   80107979 <uartputc>
  cgaputc(c);
80100795:	8b 45 08             	mov    0x8(%ebp),%eax
80100798:	89 04 24             	mov    %eax,(%esp)
8010079b:	e8 22 fe ff ff       	call   801005c2 <cgaputc>
}
801007a0:	c9                   	leave  
801007a1:	c3                   	ret    

801007a2 <consoleintr>:

#define C(x)  ((x)-'@')  // Control-x

void
consoleintr(int (*getc)(void))
{
801007a2:	55                   	push   %ebp
801007a3:	89 e5                	mov    %esp,%ebp
801007a5:	83 ec 28             	sub    $0x28,%esp
  int c;

  acquire(&input.lock);
801007a8:	c7 04 24 00 ee 10 80 	movl   $0x8010ee00,(%esp)
801007af:	e8 53 54 00 00       	call   80105c07 <acquire>
  while((c = getc()) >= 0){
801007b4:	e9 41 01 00 00       	jmp    801008fa <consoleintr+0x158>
    switch(c){
801007b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801007bc:	83 f8 10             	cmp    $0x10,%eax
801007bf:	74 1e                	je     801007df <consoleintr+0x3d>
801007c1:	83 f8 10             	cmp    $0x10,%eax
801007c4:	7f 0a                	jg     801007d0 <consoleintr+0x2e>
801007c6:	83 f8 08             	cmp    $0x8,%eax
801007c9:	74 68                	je     80100833 <consoleintr+0x91>
801007cb:	e9 94 00 00 00       	jmp    80100864 <consoleintr+0xc2>
801007d0:	83 f8 15             	cmp    $0x15,%eax
801007d3:	74 2f                	je     80100804 <consoleintr+0x62>
801007d5:	83 f8 7f             	cmp    $0x7f,%eax
801007d8:	74 59                	je     80100833 <consoleintr+0x91>
801007da:	e9 85 00 00 00       	jmp    80100864 <consoleintr+0xc2>
    case C('P'):  // Process listing.
      procdump();
801007df:	e8 d7 43 00 00       	call   80104bbb <procdump>
      break;
801007e4:	e9 11 01 00 00       	jmp    801008fa <consoleintr+0x158>
    case C('U'):  // Kill line.
      while(input.e != input.w &&
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
801007e9:	a1 bc ee 10 80       	mov    0x8010eebc,%eax
801007ee:	83 e8 01             	sub    $0x1,%eax
801007f1:	a3 bc ee 10 80       	mov    %eax,0x8010eebc
        consputc(BACKSPACE);
801007f6:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
801007fd:	e8 43 ff ff ff       	call   80100745 <consputc>
80100802:	eb 01                	jmp    80100805 <consoleintr+0x63>
    switch(c){
    case C('P'):  // Process listing.
      procdump();
      break;
    case C('U'):  // Kill line.
      while(input.e != input.w &&
80100804:	90                   	nop
80100805:	8b 15 bc ee 10 80    	mov    0x8010eebc,%edx
8010080b:	a1 b8 ee 10 80       	mov    0x8010eeb8,%eax
80100810:	39 c2                	cmp    %eax,%edx
80100812:	0f 84 db 00 00 00    	je     801008f3 <consoleintr+0x151>
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
80100818:	a1 bc ee 10 80       	mov    0x8010eebc,%eax
8010081d:	83 e8 01             	sub    $0x1,%eax
80100820:	83 e0 7f             	and    $0x7f,%eax
80100823:	0f b6 80 34 ee 10 80 	movzbl -0x7fef11cc(%eax),%eax
    switch(c){
    case C('P'):  // Process listing.
      procdump();
      break;
    case C('U'):  // Kill line.
      while(input.e != input.w &&
8010082a:	3c 0a                	cmp    $0xa,%al
8010082c:	75 bb                	jne    801007e9 <consoleintr+0x47>
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
        consputc(BACKSPACE);
      }
      break;
8010082e:	e9 c0 00 00 00       	jmp    801008f3 <consoleintr+0x151>
    case C('H'): case '\x7f':  // Backspace
      if(input.e != input.w){
80100833:	8b 15 bc ee 10 80    	mov    0x8010eebc,%edx
80100839:	a1 b8 ee 10 80       	mov    0x8010eeb8,%eax
8010083e:	39 c2                	cmp    %eax,%edx
80100840:	0f 84 b0 00 00 00    	je     801008f6 <consoleintr+0x154>
        input.e--;
80100846:	a1 bc ee 10 80       	mov    0x8010eebc,%eax
8010084b:	83 e8 01             	sub    $0x1,%eax
8010084e:	a3 bc ee 10 80       	mov    %eax,0x8010eebc
        consputc(BACKSPACE);
80100853:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
8010085a:	e8 e6 fe ff ff       	call   80100745 <consputc>
      }
      break;
8010085f:	e9 92 00 00 00       	jmp    801008f6 <consoleintr+0x154>
    default:
      if(c != 0 && input.e-input.r < INPUT_BUF){
80100864:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80100868:	0f 84 8b 00 00 00    	je     801008f9 <consoleintr+0x157>
8010086e:	8b 15 bc ee 10 80    	mov    0x8010eebc,%edx
80100874:	a1 b4 ee 10 80       	mov    0x8010eeb4,%eax
80100879:	89 d1                	mov    %edx,%ecx
8010087b:	29 c1                	sub    %eax,%ecx
8010087d:	89 c8                	mov    %ecx,%eax
8010087f:	83 f8 7f             	cmp    $0x7f,%eax
80100882:	77 75                	ja     801008f9 <consoleintr+0x157>
        c = (c == '\r') ? '\n' : c;
80100884:	83 7d f4 0d          	cmpl   $0xd,-0xc(%ebp)
80100888:	74 05                	je     8010088f <consoleintr+0xed>
8010088a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010088d:	eb 05                	jmp    80100894 <consoleintr+0xf2>
8010088f:	b8 0a 00 00 00       	mov    $0xa,%eax
80100894:	89 45 f4             	mov    %eax,-0xc(%ebp)
        input.buf[input.e++ % INPUT_BUF] = c;
80100897:	a1 bc ee 10 80       	mov    0x8010eebc,%eax
8010089c:	89 c1                	mov    %eax,%ecx
8010089e:	83 e1 7f             	and    $0x7f,%ecx
801008a1:	8b 55 f4             	mov    -0xc(%ebp),%edx
801008a4:	88 91 34 ee 10 80    	mov    %dl,-0x7fef11cc(%ecx)
801008aa:	83 c0 01             	add    $0x1,%eax
801008ad:	a3 bc ee 10 80       	mov    %eax,0x8010eebc
        consputc(c);
801008b2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801008b5:	89 04 24             	mov    %eax,(%esp)
801008b8:	e8 88 fe ff ff       	call   80100745 <consputc>
        if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
801008bd:	83 7d f4 0a          	cmpl   $0xa,-0xc(%ebp)
801008c1:	74 18                	je     801008db <consoleintr+0x139>
801008c3:	83 7d f4 04          	cmpl   $0x4,-0xc(%ebp)
801008c7:	74 12                	je     801008db <consoleintr+0x139>
801008c9:	a1 bc ee 10 80       	mov    0x8010eebc,%eax
801008ce:	8b 15 b4 ee 10 80    	mov    0x8010eeb4,%edx
801008d4:	83 ea 80             	sub    $0xffffff80,%edx
801008d7:	39 d0                	cmp    %edx,%eax
801008d9:	75 1e                	jne    801008f9 <consoleintr+0x157>
          input.w = input.e;
801008db:	a1 bc ee 10 80       	mov    0x8010eebc,%eax
801008e0:	a3 b8 ee 10 80       	mov    %eax,0x8010eeb8
          wakeup(&input.r);
801008e5:	c7 04 24 b4 ee 10 80 	movl   $0x8010eeb4,(%esp)
801008ec:	e8 24 42 00 00       	call   80104b15 <wakeup>
        }
      }
      break;
801008f1:	eb 06                	jmp    801008f9 <consoleintr+0x157>
      while(input.e != input.w &&
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
        consputc(BACKSPACE);
      }
      break;
801008f3:	90                   	nop
801008f4:	eb 04                	jmp    801008fa <consoleintr+0x158>
    case C('H'): case '\x7f':  // Backspace
      if(input.e != input.w){
        input.e--;
        consputc(BACKSPACE);
      }
      break;
801008f6:	90                   	nop
801008f7:	eb 01                	jmp    801008fa <consoleintr+0x158>
        if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
          input.w = input.e;
          wakeup(&input.r);
        }
      }
      break;
801008f9:	90                   	nop
consoleintr(int (*getc)(void))
{
  int c;

  acquire(&input.lock);
  while((c = getc()) >= 0){
801008fa:	8b 45 08             	mov    0x8(%ebp),%eax
801008fd:	ff d0                	call   *%eax
801008ff:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100902:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80100906:	0f 89 ad fe ff ff    	jns    801007b9 <consoleintr+0x17>
        }
      }
      break;
    }
  }
  release(&input.lock);
8010090c:	c7 04 24 00 ee 10 80 	movl   $0x8010ee00,(%esp)
80100913:	e8 51 53 00 00       	call   80105c69 <release>
}
80100918:	c9                   	leave  
80100919:	c3                   	ret    

8010091a <consoleread>:

int
consoleread(struct inode *ip, char *dst, int n)
{
8010091a:	55                   	push   %ebp
8010091b:	89 e5                	mov    %esp,%ebp
8010091d:	83 ec 28             	sub    $0x28,%esp
  uint target;
  int c;

  iunlock(ip);
80100920:	8b 45 08             	mov    0x8(%ebp),%eax
80100923:	89 04 24             	mov    %eax,(%esp)
80100926:	e8 8f 10 00 00       	call   801019ba <iunlock>
  target = n;
8010092b:	8b 45 10             	mov    0x10(%ebp),%eax
8010092e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  acquire(&input.lock);
80100931:	c7 04 24 00 ee 10 80 	movl   $0x8010ee00,(%esp)
80100938:	e8 ca 52 00 00       	call   80105c07 <acquire>
  while(n > 0){
8010093d:	e9 a8 00 00 00       	jmp    801009ea <consoleread+0xd0>
    while(input.r == input.w){
      if(proc->killed){
80100942:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100948:	8b 40 24             	mov    0x24(%eax),%eax
8010094b:	85 c0                	test   %eax,%eax
8010094d:	74 21                	je     80100970 <consoleread+0x56>
        release(&input.lock);
8010094f:	c7 04 24 00 ee 10 80 	movl   $0x8010ee00,(%esp)
80100956:	e8 0e 53 00 00       	call   80105c69 <release>
        ilock(ip);
8010095b:	8b 45 08             	mov    0x8(%ebp),%eax
8010095e:	89 04 24             	mov    %eax,(%esp)
80100961:	e8 1a 0f 00 00       	call   80101880 <ilock>
        return -1;
80100966:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010096b:	e9 a9 00 00 00       	jmp    80100a19 <consoleread+0xff>
      }
      sleep(&input.r, &input.lock);
80100970:	c7 44 24 04 00 ee 10 	movl   $0x8010ee00,0x4(%esp)
80100977:	80 
80100978:	c7 04 24 b4 ee 10 80 	movl   $0x8010eeb4,(%esp)
8010097f:	e8 4d 40 00 00       	call   801049d1 <sleep>
80100984:	eb 01                	jmp    80100987 <consoleread+0x6d>

  iunlock(ip);
  target = n;
  acquire(&input.lock);
  while(n > 0){
    while(input.r == input.w){
80100986:	90                   	nop
80100987:	8b 15 b4 ee 10 80    	mov    0x8010eeb4,%edx
8010098d:	a1 b8 ee 10 80       	mov    0x8010eeb8,%eax
80100992:	39 c2                	cmp    %eax,%edx
80100994:	74 ac                	je     80100942 <consoleread+0x28>
        ilock(ip);
        return -1;
      }
      sleep(&input.r, &input.lock);
    }
    c = input.buf[input.r++ % INPUT_BUF];
80100996:	a1 b4 ee 10 80       	mov    0x8010eeb4,%eax
8010099b:	89 c2                	mov    %eax,%edx
8010099d:	83 e2 7f             	and    $0x7f,%edx
801009a0:	0f b6 92 34 ee 10 80 	movzbl -0x7fef11cc(%edx),%edx
801009a7:	0f be d2             	movsbl %dl,%edx
801009aa:	89 55 f0             	mov    %edx,-0x10(%ebp)
801009ad:	83 c0 01             	add    $0x1,%eax
801009b0:	a3 b4 ee 10 80       	mov    %eax,0x8010eeb4
    if(c == C('D')){  // EOF
801009b5:	83 7d f0 04          	cmpl   $0x4,-0x10(%ebp)
801009b9:	75 17                	jne    801009d2 <consoleread+0xb8>
      if(n < target){
801009bb:	8b 45 10             	mov    0x10(%ebp),%eax
801009be:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801009c1:	73 2f                	jae    801009f2 <consoleread+0xd8>
        // Save ^D for next time, to make sure
        // caller gets a 0-byte result.
        input.r--;
801009c3:	a1 b4 ee 10 80       	mov    0x8010eeb4,%eax
801009c8:	83 e8 01             	sub    $0x1,%eax
801009cb:	a3 b4 ee 10 80       	mov    %eax,0x8010eeb4
      }
      break;
801009d0:	eb 20                	jmp    801009f2 <consoleread+0xd8>
    }
    *dst++ = c;
801009d2:	8b 45 f0             	mov    -0x10(%ebp),%eax
801009d5:	89 c2                	mov    %eax,%edx
801009d7:	8b 45 0c             	mov    0xc(%ebp),%eax
801009da:	88 10                	mov    %dl,(%eax)
801009dc:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
    --n;
801009e0:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
    if(c == '\n')
801009e4:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
801009e8:	74 0b                	je     801009f5 <consoleread+0xdb>
  int c;

  iunlock(ip);
  target = n;
  acquire(&input.lock);
  while(n > 0){
801009ea:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801009ee:	7f 96                	jg     80100986 <consoleread+0x6c>
801009f0:	eb 04                	jmp    801009f6 <consoleread+0xdc>
      if(n < target){
        // Save ^D for next time, to make sure
        // caller gets a 0-byte result.
        input.r--;
      }
      break;
801009f2:	90                   	nop
801009f3:	eb 01                	jmp    801009f6 <consoleread+0xdc>
    }
    *dst++ = c;
    --n;
    if(c == '\n')
      break;
801009f5:	90                   	nop
  }
  release(&input.lock);
801009f6:	c7 04 24 00 ee 10 80 	movl   $0x8010ee00,(%esp)
801009fd:	e8 67 52 00 00       	call   80105c69 <release>
  ilock(ip);
80100a02:	8b 45 08             	mov    0x8(%ebp),%eax
80100a05:	89 04 24             	mov    %eax,(%esp)
80100a08:	e8 73 0e 00 00       	call   80101880 <ilock>

  return target - n;
80100a0d:	8b 45 10             	mov    0x10(%ebp),%eax
80100a10:	8b 55 f4             	mov    -0xc(%ebp),%edx
80100a13:	89 d1                	mov    %edx,%ecx
80100a15:	29 c1                	sub    %eax,%ecx
80100a17:	89 c8                	mov    %ecx,%eax
}
80100a19:	c9                   	leave  
80100a1a:	c3                   	ret    

80100a1b <consolewrite>:

int
consolewrite(struct inode *ip, char *buf, int n)
{
80100a1b:	55                   	push   %ebp
80100a1c:	89 e5                	mov    %esp,%ebp
80100a1e:	83 ec 28             	sub    $0x28,%esp
  int i;

  iunlock(ip);
80100a21:	8b 45 08             	mov    0x8(%ebp),%eax
80100a24:	89 04 24             	mov    %eax,(%esp)
80100a27:	e8 8e 0f 00 00       	call   801019ba <iunlock>
  acquire(&cons.lock);
80100a2c:	c7 04 24 20 c6 10 80 	movl   $0x8010c620,(%esp)
80100a33:	e8 cf 51 00 00       	call   80105c07 <acquire>
  for(i = 0; i < n; i++)
80100a38:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80100a3f:	eb 1f                	jmp    80100a60 <consolewrite+0x45>
    consputc(buf[i] & 0xff);
80100a41:	8b 55 f4             	mov    -0xc(%ebp),%edx
80100a44:	8b 45 0c             	mov    0xc(%ebp),%eax
80100a47:	01 d0                	add    %edx,%eax
80100a49:	0f b6 00             	movzbl (%eax),%eax
80100a4c:	0f be c0             	movsbl %al,%eax
80100a4f:	25 ff 00 00 00       	and    $0xff,%eax
80100a54:	89 04 24             	mov    %eax,(%esp)
80100a57:	e8 e9 fc ff ff       	call   80100745 <consputc>
{
  int i;

  iunlock(ip);
  acquire(&cons.lock);
  for(i = 0; i < n; i++)
80100a5c:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100a60:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100a63:	3b 45 10             	cmp    0x10(%ebp),%eax
80100a66:	7c d9                	jl     80100a41 <consolewrite+0x26>
    consputc(buf[i] & 0xff);
  release(&cons.lock);
80100a68:	c7 04 24 20 c6 10 80 	movl   $0x8010c620,(%esp)
80100a6f:	e8 f5 51 00 00       	call   80105c69 <release>
  ilock(ip);
80100a74:	8b 45 08             	mov    0x8(%ebp),%eax
80100a77:	89 04 24             	mov    %eax,(%esp)
80100a7a:	e8 01 0e 00 00       	call   80101880 <ilock>

  return n;
80100a7f:	8b 45 10             	mov    0x10(%ebp),%eax
}
80100a82:	c9                   	leave  
80100a83:	c3                   	ret    

80100a84 <consoleinit>:

void
consoleinit(void)
{
80100a84:	55                   	push   %ebp
80100a85:	89 e5                	mov    %esp,%ebp
80100a87:	83 ec 18             	sub    $0x18,%esp
  initlock(&cons.lock, "console");
80100a8a:	c7 44 24 04 77 93 10 	movl   $0x80109377,0x4(%esp)
80100a91:	80 
80100a92:	c7 04 24 20 c6 10 80 	movl   $0x8010c620,(%esp)
80100a99:	e8 48 51 00 00       	call   80105be6 <initlock>
  initlock(&input.lock, "input");
80100a9e:	c7 44 24 04 7f 93 10 	movl   $0x8010937f,0x4(%esp)
80100aa5:	80 
80100aa6:	c7 04 24 00 ee 10 80 	movl   $0x8010ee00,(%esp)
80100aad:	e8 34 51 00 00       	call   80105be6 <initlock>

  devsw[CONSOLE].write = consolewrite;
80100ab2:	c7 05 6c f8 10 80 1b 	movl   $0x80100a1b,0x8010f86c
80100ab9:	0a 10 80 
  devsw[CONSOLE].read = consoleread;
80100abc:	c7 05 68 f8 10 80 1a 	movl   $0x8010091a,0x8010f868
80100ac3:	09 10 80 
  cons.locking = 1;
80100ac6:	c7 05 54 c6 10 80 01 	movl   $0x1,0x8010c654
80100acd:	00 00 00 

  picenable(IRQ_KBD);
80100ad0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80100ad7:	e8 71 30 00 00       	call   80103b4d <picenable>
  ioapicenable(IRQ_KBD, 0);
80100adc:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80100ae3:	00 
80100ae4:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80100aeb:	e8 92 1e 00 00       	call   80102982 <ioapicenable>
}
80100af0:	c9                   	leave  
80100af1:	c3                   	ret    
80100af2:	66 90                	xchg   %ax,%ax

80100af4 <exec>:
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
{
80100af4:	55                   	push   %ebp
80100af5:	89 e5                	mov    %esp,%ebp
80100af7:	81 ec 38 01 00 00    	sub    $0x138,%esp
  struct elfhdr elf;
  struct inode *ip;
  struct proghdr ph;
  pde_t *pgdir, *oldpgdir;

  if((ip = namei(path)) == 0)
80100afd:	8b 45 08             	mov    0x8(%ebp),%eax
80100b00:	89 04 24             	mov    %eax,(%esp)
80100b03:	e8 25 19 00 00       	call   8010242d <namei>
80100b08:	89 45 d8             	mov    %eax,-0x28(%ebp)
80100b0b:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
80100b0f:	75 0a                	jne    80100b1b <exec+0x27>
    return -1;
80100b11:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80100b16:	e9 f6 03 00 00       	jmp    80100f11 <exec+0x41d>
  ilock(ip);
80100b1b:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100b1e:	89 04 24             	mov    %eax,(%esp)
80100b21:	e8 5a 0d 00 00       	call   80101880 <ilock>
  pgdir = 0;
80100b26:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)

  // Check ELF header
  if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
80100b2d:	c7 44 24 0c 34 00 00 	movl   $0x34,0xc(%esp)
80100b34:	00 
80100b35:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80100b3c:	00 
80100b3d:	8d 85 0c ff ff ff    	lea    -0xf4(%ebp),%eax
80100b43:	89 44 24 04          	mov    %eax,0x4(%esp)
80100b47:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100b4a:	89 04 24             	mov    %eax,(%esp)
80100b4d:	e8 27 12 00 00       	call   80101d79 <readi>
80100b52:	83 f8 33             	cmp    $0x33,%eax
80100b55:	0f 86 70 03 00 00    	jbe    80100ecb <exec+0x3d7>
    goto bad;
  if(elf.magic != ELF_MAGIC)
80100b5b:	8b 85 0c ff ff ff    	mov    -0xf4(%ebp),%eax
80100b61:	3d 7f 45 4c 46       	cmp    $0x464c457f,%eax
80100b66:	0f 85 62 03 00 00    	jne    80100ece <exec+0x3da>
    goto bad;

  if((pgdir = setupkvm(kalloc)) == 0)
80100b6c:	c7 04 24 66 2b 10 80 	movl   $0x80102b66,(%esp)
80100b73:	e8 53 7f 00 00       	call   80108acb <setupkvm>
80100b78:	89 45 d4             	mov    %eax,-0x2c(%ebp)
80100b7b:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
80100b7f:	0f 84 4c 03 00 00    	je     80100ed1 <exec+0x3dd>
    goto bad;

  // Load program into memory.
  sz = 0;
80100b85:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100b8c:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
80100b93:	8b 85 28 ff ff ff    	mov    -0xd8(%ebp),%eax
80100b99:	89 45 e8             	mov    %eax,-0x18(%ebp)
80100b9c:	e9 c5 00 00 00       	jmp    80100c66 <exec+0x172>
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100ba1:	8b 45 e8             	mov    -0x18(%ebp),%eax
80100ba4:	c7 44 24 0c 20 00 00 	movl   $0x20,0xc(%esp)
80100bab:	00 
80100bac:	89 44 24 08          	mov    %eax,0x8(%esp)
80100bb0:	8d 85 ec fe ff ff    	lea    -0x114(%ebp),%eax
80100bb6:	89 44 24 04          	mov    %eax,0x4(%esp)
80100bba:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100bbd:	89 04 24             	mov    %eax,(%esp)
80100bc0:	e8 b4 11 00 00       	call   80101d79 <readi>
80100bc5:	83 f8 20             	cmp    $0x20,%eax
80100bc8:	0f 85 06 03 00 00    	jne    80100ed4 <exec+0x3e0>
      goto bad;
    if(ph.type != ELF_PROG_LOAD)
80100bce:	8b 85 ec fe ff ff    	mov    -0x114(%ebp),%eax
80100bd4:	83 f8 01             	cmp    $0x1,%eax
80100bd7:	75 7f                	jne    80100c58 <exec+0x164>
      continue;
    if(ph.memsz < ph.filesz)
80100bd9:	8b 95 00 ff ff ff    	mov    -0x100(%ebp),%edx
80100bdf:	8b 85 fc fe ff ff    	mov    -0x104(%ebp),%eax
80100be5:	39 c2                	cmp    %eax,%edx
80100be7:	0f 82 ea 02 00 00    	jb     80100ed7 <exec+0x3e3>
      goto bad;
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100bed:	8b 95 f4 fe ff ff    	mov    -0x10c(%ebp),%edx
80100bf3:	8b 85 00 ff ff ff    	mov    -0x100(%ebp),%eax
80100bf9:	01 d0                	add    %edx,%eax
80100bfb:	89 44 24 08          	mov    %eax,0x8(%esp)
80100bff:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100c02:	89 44 24 04          	mov    %eax,0x4(%esp)
80100c06:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100c09:	89 04 24             	mov    %eax,(%esp)
80100c0c:	e8 8c 82 00 00       	call   80108e9d <allocuvm>
80100c11:	89 45 e0             	mov    %eax,-0x20(%ebp)
80100c14:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
80100c18:	0f 84 bc 02 00 00    	je     80100eda <exec+0x3e6>
      goto bad;
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100c1e:	8b 8d fc fe ff ff    	mov    -0x104(%ebp),%ecx
80100c24:	8b 95 f0 fe ff ff    	mov    -0x110(%ebp),%edx
80100c2a:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
80100c30:	89 4c 24 10          	mov    %ecx,0x10(%esp)
80100c34:	89 54 24 0c          	mov    %edx,0xc(%esp)
80100c38:	8b 55 d8             	mov    -0x28(%ebp),%edx
80100c3b:	89 54 24 08          	mov    %edx,0x8(%esp)
80100c3f:	89 44 24 04          	mov    %eax,0x4(%esp)
80100c43:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100c46:	89 04 24             	mov    %eax,(%esp)
80100c49:	e8 60 81 00 00       	call   80108dae <loaduvm>
80100c4e:	85 c0                	test   %eax,%eax
80100c50:	0f 88 87 02 00 00    	js     80100edd <exec+0x3e9>
80100c56:	eb 01                	jmp    80100c59 <exec+0x165>
  sz = 0;
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
      goto bad;
    if(ph.type != ELF_PROG_LOAD)
      continue;
80100c58:	90                   	nop
  if((pgdir = setupkvm(kalloc)) == 0)
    goto bad;

  // Load program into memory.
  sz = 0;
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100c59:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
80100c5d:	8b 45 e8             	mov    -0x18(%ebp),%eax
80100c60:	83 c0 20             	add    $0x20,%eax
80100c63:	89 45 e8             	mov    %eax,-0x18(%ebp)
80100c66:	0f b7 85 38 ff ff ff 	movzwl -0xc8(%ebp),%eax
80100c6d:	0f b7 c0             	movzwl %ax,%eax
80100c70:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80100c73:	0f 8f 28 ff ff ff    	jg     80100ba1 <exec+0xad>
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
      goto bad;
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
      goto bad;
  }
  iunlockput(ip);
80100c79:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100c7c:	89 04 24             	mov    %eax,(%esp)
80100c7f:	e8 6c 0e 00 00       	call   80101af0 <iunlockput>
  ip = 0;
80100c84:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)

  // Allocate two pages at the next page boundary.
  // Make the first inaccessible.  Use the second as the user stack.
  sz = PGROUNDUP(sz);
80100c8b:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100c8e:	05 ff 0f 00 00       	add    $0xfff,%eax
80100c93:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80100c98:	89 45 e0             	mov    %eax,-0x20(%ebp)
  if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100c9b:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100c9e:	05 00 20 00 00       	add    $0x2000,%eax
80100ca3:	89 44 24 08          	mov    %eax,0x8(%esp)
80100ca7:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100caa:	89 44 24 04          	mov    %eax,0x4(%esp)
80100cae:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100cb1:	89 04 24             	mov    %eax,(%esp)
80100cb4:	e8 e4 81 00 00       	call   80108e9d <allocuvm>
80100cb9:	89 45 e0             	mov    %eax,-0x20(%ebp)
80100cbc:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
80100cc0:	0f 84 1a 02 00 00    	je     80100ee0 <exec+0x3ec>
    goto bad;
  clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100cc6:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100cc9:	2d 00 20 00 00       	sub    $0x2000,%eax
80100cce:	89 44 24 04          	mov    %eax,0x4(%esp)
80100cd2:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100cd5:	89 04 24             	mov    %eax,(%esp)
80100cd8:	e8 f0 83 00 00       	call   801090cd <clearpteu>
  sp = sz;
80100cdd:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100ce0:	89 45 dc             	mov    %eax,-0x24(%ebp)

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
80100ce3:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
80100cea:	e9 97 00 00 00       	jmp    80100d86 <exec+0x292>
    if(argc >= MAXARG)
80100cef:	83 7d e4 1f          	cmpl   $0x1f,-0x1c(%ebp)
80100cf3:	0f 87 ea 01 00 00    	ja     80100ee3 <exec+0x3ef>
      goto bad;
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100cf9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100cfc:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100d03:	8b 45 0c             	mov    0xc(%ebp),%eax
80100d06:	01 d0                	add    %edx,%eax
80100d08:	8b 00                	mov    (%eax),%eax
80100d0a:	89 04 24             	mov    %eax,(%esp)
80100d0d:	e8 ce 53 00 00       	call   801060e0 <strlen>
80100d12:	f7 d0                	not    %eax
80100d14:	89 c2                	mov    %eax,%edx
80100d16:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100d19:	01 d0                	add    %edx,%eax
80100d1b:	83 e0 fc             	and    $0xfffffffc,%eax
80100d1e:	89 45 dc             	mov    %eax,-0x24(%ebp)
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100d21:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d24:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100d2b:	8b 45 0c             	mov    0xc(%ebp),%eax
80100d2e:	01 d0                	add    %edx,%eax
80100d30:	8b 00                	mov    (%eax),%eax
80100d32:	89 04 24             	mov    %eax,(%esp)
80100d35:	e8 a6 53 00 00       	call   801060e0 <strlen>
80100d3a:	83 c0 01             	add    $0x1,%eax
80100d3d:	89 c2                	mov    %eax,%edx
80100d3f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d42:	8d 0c 85 00 00 00 00 	lea    0x0(,%eax,4),%ecx
80100d49:	8b 45 0c             	mov    0xc(%ebp),%eax
80100d4c:	01 c8                	add    %ecx,%eax
80100d4e:	8b 00                	mov    (%eax),%eax
80100d50:	89 54 24 0c          	mov    %edx,0xc(%esp)
80100d54:	89 44 24 08          	mov    %eax,0x8(%esp)
80100d58:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100d5b:	89 44 24 04          	mov    %eax,0x4(%esp)
80100d5f:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100d62:	89 04 24             	mov    %eax,(%esp)
80100d65:	e8 17 85 00 00       	call   80109281 <copyout>
80100d6a:	85 c0                	test   %eax,%eax
80100d6c:	0f 88 74 01 00 00    	js     80100ee6 <exec+0x3f2>
      goto bad;
    ustack[3+argc] = sp;
80100d72:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d75:	8d 50 03             	lea    0x3(%eax),%edx
80100d78:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100d7b:	89 84 95 40 ff ff ff 	mov    %eax,-0xc0(%ebp,%edx,4)
    goto bad;
  clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
  sp = sz;

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
80100d82:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
80100d86:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d89:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100d90:	8b 45 0c             	mov    0xc(%ebp),%eax
80100d93:	01 d0                	add    %edx,%eax
80100d95:	8b 00                	mov    (%eax),%eax
80100d97:	85 c0                	test   %eax,%eax
80100d99:	0f 85 50 ff ff ff    	jne    80100cef <exec+0x1fb>
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
      goto bad;
    ustack[3+argc] = sp;
  }
  ustack[3+argc] = 0;
80100d9f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100da2:	83 c0 03             	add    $0x3,%eax
80100da5:	c7 84 85 40 ff ff ff 	movl   $0x0,-0xc0(%ebp,%eax,4)
80100dac:	00 00 00 00 

  ustack[0] = 0xffffffff;  // fake return PC
80100db0:	c7 85 40 ff ff ff ff 	movl   $0xffffffff,-0xc0(%ebp)
80100db7:	ff ff ff 
  ustack[1] = argc;
80100dba:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dbd:	89 85 44 ff ff ff    	mov    %eax,-0xbc(%ebp)
  ustack[2] = sp - (argc+1)*4;  // argv pointer
80100dc3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dc6:	83 c0 01             	add    $0x1,%eax
80100dc9:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100dd0:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100dd3:	29 d0                	sub    %edx,%eax
80100dd5:	89 85 48 ff ff ff    	mov    %eax,-0xb8(%ebp)

  sp -= (3+argc+1) * 4;
80100ddb:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dde:	83 c0 04             	add    $0x4,%eax
80100de1:	c1 e0 02             	shl    $0x2,%eax
80100de4:	29 45 dc             	sub    %eax,-0x24(%ebp)
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100de7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dea:	83 c0 04             	add    $0x4,%eax
80100ded:	c1 e0 02             	shl    $0x2,%eax
80100df0:	89 44 24 0c          	mov    %eax,0xc(%esp)
80100df4:	8d 85 40 ff ff ff    	lea    -0xc0(%ebp),%eax
80100dfa:	89 44 24 08          	mov    %eax,0x8(%esp)
80100dfe:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100e01:	89 44 24 04          	mov    %eax,0x4(%esp)
80100e05:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100e08:	89 04 24             	mov    %eax,(%esp)
80100e0b:	e8 71 84 00 00       	call   80109281 <copyout>
80100e10:	85 c0                	test   %eax,%eax
80100e12:	0f 88 d1 00 00 00    	js     80100ee9 <exec+0x3f5>
    goto bad;

  // Save program name for debugging.
  for(last=s=path; *s; s++)
80100e18:	8b 45 08             	mov    0x8(%ebp),%eax
80100e1b:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100e1e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e21:	89 45 f0             	mov    %eax,-0x10(%ebp)
80100e24:	eb 17                	jmp    80100e3d <exec+0x349>
    if(*s == '/')
80100e26:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e29:	0f b6 00             	movzbl (%eax),%eax
80100e2c:	3c 2f                	cmp    $0x2f,%al
80100e2e:	75 09                	jne    80100e39 <exec+0x345>
      last = s+1;
80100e30:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e33:	83 c0 01             	add    $0x1,%eax
80100e36:	89 45 f0             	mov    %eax,-0x10(%ebp)
  sp -= (3+argc+1) * 4;
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
    goto bad;

  // Save program name for debugging.
  for(last=s=path; *s; s++)
80100e39:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100e3d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e40:	0f b6 00             	movzbl (%eax),%eax
80100e43:	84 c0                	test   %al,%al
80100e45:	75 df                	jne    80100e26 <exec+0x332>
    if(*s == '/')
      last = s+1;
  safestrcpy(proc->name, last, sizeof(proc->name));
80100e47:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e4d:	8d 50 6c             	lea    0x6c(%eax),%edx
80100e50:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
80100e57:	00 
80100e58:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100e5b:	89 44 24 04          	mov    %eax,0x4(%esp)
80100e5f:	89 14 24             	mov    %edx,(%esp)
80100e62:	e8 2b 52 00 00       	call   80106092 <safestrcpy>

  // Commit to the user image.
  oldpgdir = proc->pgdir;
80100e67:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e6d:	8b 40 04             	mov    0x4(%eax),%eax
80100e70:	89 45 d0             	mov    %eax,-0x30(%ebp)
  proc->pgdir = pgdir;
80100e73:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e79:	8b 55 d4             	mov    -0x2c(%ebp),%edx
80100e7c:	89 50 04             	mov    %edx,0x4(%eax)
  proc->sz = sz;
80100e7f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e85:	8b 55 e0             	mov    -0x20(%ebp),%edx
80100e88:	89 10                	mov    %edx,(%eax)
  proc->tf->eip = elf.entry;  // main
80100e8a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e90:	8b 40 18             	mov    0x18(%eax),%eax
80100e93:	8b 95 24 ff ff ff    	mov    -0xdc(%ebp),%edx
80100e99:	89 50 38             	mov    %edx,0x38(%eax)
  proc->tf->esp = sp;
80100e9c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100ea2:	8b 40 18             	mov    0x18(%eax),%eax
80100ea5:	8b 55 dc             	mov    -0x24(%ebp),%edx
80100ea8:	89 50 44             	mov    %edx,0x44(%eax)
  switchuvm(proc);
80100eab:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100eb1:	89 04 24             	mov    %eax,(%esp)
80100eb4:	e8 03 7d 00 00       	call   80108bbc <switchuvm>
  freevm(oldpgdir);
80100eb9:	8b 45 d0             	mov    -0x30(%ebp),%eax
80100ebc:	89 04 24             	mov    %eax,(%esp)
80100ebf:	e8 6f 81 00 00       	call   80109033 <freevm>
  return 0;
80100ec4:	b8 00 00 00 00       	mov    $0x0,%eax
80100ec9:	eb 46                	jmp    80100f11 <exec+0x41d>
  ilock(ip);
  pgdir = 0;

  // Check ELF header
  if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
    goto bad;
80100ecb:	90                   	nop
80100ecc:	eb 1c                	jmp    80100eea <exec+0x3f6>
  if(elf.magic != ELF_MAGIC)
    goto bad;
80100ece:	90                   	nop
80100ecf:	eb 19                	jmp    80100eea <exec+0x3f6>

  if((pgdir = setupkvm(kalloc)) == 0)
    goto bad;
80100ed1:	90                   	nop
80100ed2:	eb 16                	jmp    80100eea <exec+0x3f6>

  // Load program into memory.
  sz = 0;
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
      goto bad;
80100ed4:	90                   	nop
80100ed5:	eb 13                	jmp    80100eea <exec+0x3f6>
    if(ph.type != ELF_PROG_LOAD)
      continue;
    if(ph.memsz < ph.filesz)
      goto bad;
80100ed7:	90                   	nop
80100ed8:	eb 10                	jmp    80100eea <exec+0x3f6>
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
      goto bad;
80100eda:	90                   	nop
80100edb:	eb 0d                	jmp    80100eea <exec+0x3f6>
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
      goto bad;
80100edd:	90                   	nop
80100ede:	eb 0a                	jmp    80100eea <exec+0x3f6>

  // Allocate two pages at the next page boundary.
  // Make the first inaccessible.  Use the second as the user stack.
  sz = PGROUNDUP(sz);
  if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
    goto bad;
80100ee0:	90                   	nop
80100ee1:	eb 07                	jmp    80100eea <exec+0x3f6>
  sp = sz;

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
    if(argc >= MAXARG)
      goto bad;
80100ee3:	90                   	nop
80100ee4:	eb 04                	jmp    80100eea <exec+0x3f6>
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
      goto bad;
80100ee6:	90                   	nop
80100ee7:	eb 01                	jmp    80100eea <exec+0x3f6>
  ustack[1] = argc;
  ustack[2] = sp - (argc+1)*4;  // argv pointer

  sp -= (3+argc+1) * 4;
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
    goto bad;
80100ee9:	90                   	nop
  switchuvm(proc);
  freevm(oldpgdir);
  return 0;

 bad:
  if(pgdir)
80100eea:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
80100eee:	74 0b                	je     80100efb <exec+0x407>
    freevm(pgdir);
80100ef0:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100ef3:	89 04 24             	mov    %eax,(%esp)
80100ef6:	e8 38 81 00 00       	call   80109033 <freevm>
  if(ip)
80100efb:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
80100eff:	74 0b                	je     80100f0c <exec+0x418>
    iunlockput(ip);
80100f01:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100f04:	89 04 24             	mov    %eax,(%esp)
80100f07:	e8 e4 0b 00 00       	call   80101af0 <iunlockput>
  return -1;
80100f0c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80100f11:	c9                   	leave  
80100f12:	c3                   	ret    
80100f13:	90                   	nop

80100f14 <fileinit>:
  struct file file[NFILE];
} ftable;

void
fileinit(void)
{
80100f14:	55                   	push   %ebp
80100f15:	89 e5                	mov    %esp,%ebp
80100f17:	83 ec 18             	sub    $0x18,%esp
  initlock(&ftable.lock, "ftable");
80100f1a:	c7 44 24 04 85 93 10 	movl   $0x80109385,0x4(%esp)
80100f21:	80 
80100f22:	c7 04 24 c0 ee 10 80 	movl   $0x8010eec0,(%esp)
80100f29:	e8 b8 4c 00 00       	call   80105be6 <initlock>
}
80100f2e:	c9                   	leave  
80100f2f:	c3                   	ret    

80100f30 <filealloc>:

// Allocate a file structure.
struct file*
filealloc(void)
{
80100f30:	55                   	push   %ebp
80100f31:	89 e5                	mov    %esp,%ebp
80100f33:	83 ec 28             	sub    $0x28,%esp
  struct file *f;

  acquire(&ftable.lock);
80100f36:	c7 04 24 c0 ee 10 80 	movl   $0x8010eec0,(%esp)
80100f3d:	e8 c5 4c 00 00       	call   80105c07 <acquire>
  for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f42:	c7 45 f4 f4 ee 10 80 	movl   $0x8010eef4,-0xc(%ebp)
80100f49:	eb 29                	jmp    80100f74 <filealloc+0x44>
    if(f->ref == 0){
80100f4b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f4e:	8b 40 04             	mov    0x4(%eax),%eax
80100f51:	85 c0                	test   %eax,%eax
80100f53:	75 1b                	jne    80100f70 <filealloc+0x40>
      f->ref = 1;
80100f55:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f58:	c7 40 04 01 00 00 00 	movl   $0x1,0x4(%eax)
      release(&ftable.lock);
80100f5f:	c7 04 24 c0 ee 10 80 	movl   $0x8010eec0,(%esp)
80100f66:	e8 fe 4c 00 00       	call   80105c69 <release>
      return f;
80100f6b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f6e:	eb 1e                	jmp    80100f8e <filealloc+0x5e>
filealloc(void)
{
  struct file *f;

  acquire(&ftable.lock);
  for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f70:	83 45 f4 18          	addl   $0x18,-0xc(%ebp)
80100f74:	81 7d f4 54 f8 10 80 	cmpl   $0x8010f854,-0xc(%ebp)
80100f7b:	72 ce                	jb     80100f4b <filealloc+0x1b>
      f->ref = 1;
      release(&ftable.lock);
      return f;
    }
  }
  release(&ftable.lock);
80100f7d:	c7 04 24 c0 ee 10 80 	movl   $0x8010eec0,(%esp)
80100f84:	e8 e0 4c 00 00       	call   80105c69 <release>
  return 0;
80100f89:	b8 00 00 00 00       	mov    $0x0,%eax
}
80100f8e:	c9                   	leave  
80100f8f:	c3                   	ret    

80100f90 <filedup>:

// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80100f90:	55                   	push   %ebp
80100f91:	89 e5                	mov    %esp,%ebp
80100f93:	83 ec 18             	sub    $0x18,%esp
  acquire(&ftable.lock);
80100f96:	c7 04 24 c0 ee 10 80 	movl   $0x8010eec0,(%esp)
80100f9d:	e8 65 4c 00 00       	call   80105c07 <acquire>
  if(f->ref < 1)
80100fa2:	8b 45 08             	mov    0x8(%ebp),%eax
80100fa5:	8b 40 04             	mov    0x4(%eax),%eax
80100fa8:	85 c0                	test   %eax,%eax
80100faa:	7f 0c                	jg     80100fb8 <filedup+0x28>
    panic("filedup");
80100fac:	c7 04 24 8c 93 10 80 	movl   $0x8010938c,(%esp)
80100fb3:	e8 7a f5 ff ff       	call   80100532 <panic>
  f->ref++;
80100fb8:	8b 45 08             	mov    0x8(%ebp),%eax
80100fbb:	8b 40 04             	mov    0x4(%eax),%eax
80100fbe:	8d 50 01             	lea    0x1(%eax),%edx
80100fc1:	8b 45 08             	mov    0x8(%ebp),%eax
80100fc4:	89 50 04             	mov    %edx,0x4(%eax)
  release(&ftable.lock);
80100fc7:	c7 04 24 c0 ee 10 80 	movl   $0x8010eec0,(%esp)
80100fce:	e8 96 4c 00 00       	call   80105c69 <release>
  return f;
80100fd3:	8b 45 08             	mov    0x8(%ebp),%eax
}
80100fd6:	c9                   	leave  
80100fd7:	c3                   	ret    

80100fd8 <fileclose>:

// Close file f.  (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80100fd8:	55                   	push   %ebp
80100fd9:	89 e5                	mov    %esp,%ebp
80100fdb:	83 ec 38             	sub    $0x38,%esp
  struct file ff;

  acquire(&ftable.lock);
80100fde:	c7 04 24 c0 ee 10 80 	movl   $0x8010eec0,(%esp)
80100fe5:	e8 1d 4c 00 00       	call   80105c07 <acquire>
  if(f->ref < 1)
80100fea:	8b 45 08             	mov    0x8(%ebp),%eax
80100fed:	8b 40 04             	mov    0x4(%eax),%eax
80100ff0:	85 c0                	test   %eax,%eax
80100ff2:	7f 0c                	jg     80101000 <fileclose+0x28>
    panic("fileclose");
80100ff4:	c7 04 24 94 93 10 80 	movl   $0x80109394,(%esp)
80100ffb:	e8 32 f5 ff ff       	call   80100532 <panic>
  if(--f->ref > 0){
80101000:	8b 45 08             	mov    0x8(%ebp),%eax
80101003:	8b 40 04             	mov    0x4(%eax),%eax
80101006:	8d 50 ff             	lea    -0x1(%eax),%edx
80101009:	8b 45 08             	mov    0x8(%ebp),%eax
8010100c:	89 50 04             	mov    %edx,0x4(%eax)
8010100f:	8b 45 08             	mov    0x8(%ebp),%eax
80101012:	8b 40 04             	mov    0x4(%eax),%eax
80101015:	85 c0                	test   %eax,%eax
80101017:	7e 11                	jle    8010102a <fileclose+0x52>
    release(&ftable.lock);
80101019:	c7 04 24 c0 ee 10 80 	movl   $0x8010eec0,(%esp)
80101020:	e8 44 4c 00 00       	call   80105c69 <release>
80101025:	e9 82 00 00 00       	jmp    801010ac <fileclose+0xd4>
    return;
  }
  ff = *f;
8010102a:	8b 45 08             	mov    0x8(%ebp),%eax
8010102d:	8b 10                	mov    (%eax),%edx
8010102f:	89 55 e0             	mov    %edx,-0x20(%ebp)
80101032:	8b 50 04             	mov    0x4(%eax),%edx
80101035:	89 55 e4             	mov    %edx,-0x1c(%ebp)
80101038:	8b 50 08             	mov    0x8(%eax),%edx
8010103b:	89 55 e8             	mov    %edx,-0x18(%ebp)
8010103e:	8b 50 0c             	mov    0xc(%eax),%edx
80101041:	89 55 ec             	mov    %edx,-0x14(%ebp)
80101044:	8b 50 10             	mov    0x10(%eax),%edx
80101047:	89 55 f0             	mov    %edx,-0x10(%ebp)
8010104a:	8b 40 14             	mov    0x14(%eax),%eax
8010104d:	89 45 f4             	mov    %eax,-0xc(%ebp)
  f->ref = 0;
80101050:	8b 45 08             	mov    0x8(%ebp),%eax
80101053:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
  f->type = FD_NONE;
8010105a:	8b 45 08             	mov    0x8(%ebp),%eax
8010105d:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  release(&ftable.lock);
80101063:	c7 04 24 c0 ee 10 80 	movl   $0x8010eec0,(%esp)
8010106a:	e8 fa 4b 00 00       	call   80105c69 <release>
  
  if(ff.type == FD_PIPE)
8010106f:	8b 45 e0             	mov    -0x20(%ebp),%eax
80101072:	83 f8 01             	cmp    $0x1,%eax
80101075:	75 18                	jne    8010108f <fileclose+0xb7>
    pipeclose(ff.pipe, ff.writable);
80101077:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
8010107b:	0f be d0             	movsbl %al,%edx
8010107e:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101081:	89 54 24 04          	mov    %edx,0x4(%esp)
80101085:	89 04 24             	mov    %eax,(%esp)
80101088:	e8 7a 2d 00 00       	call   80103e07 <pipeclose>
8010108d:	eb 1d                	jmp    801010ac <fileclose+0xd4>
  else if(ff.type == FD_INODE){
8010108f:	8b 45 e0             	mov    -0x20(%ebp),%eax
80101092:	83 f8 02             	cmp    $0x2,%eax
80101095:	75 15                	jne    801010ac <fileclose+0xd4>
    begin_trans();
80101097:	e8 f0 21 00 00       	call   8010328c <begin_trans>
    iput(ff.ip);
8010109c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010109f:	89 04 24             	mov    %eax,(%esp)
801010a2:	e8 78 09 00 00       	call   80101a1f <iput>
    commit_trans();
801010a7:	e8 29 22 00 00       	call   801032d5 <commit_trans>
  }
}
801010ac:	c9                   	leave  
801010ad:	c3                   	ret    

801010ae <filestat>:

// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
801010ae:	55                   	push   %ebp
801010af:	89 e5                	mov    %esp,%ebp
801010b1:	83 ec 18             	sub    $0x18,%esp
  if(f->type == FD_INODE){
801010b4:	8b 45 08             	mov    0x8(%ebp),%eax
801010b7:	8b 00                	mov    (%eax),%eax
801010b9:	83 f8 02             	cmp    $0x2,%eax
801010bc:	75 38                	jne    801010f6 <filestat+0x48>
    ilock(f->ip);
801010be:	8b 45 08             	mov    0x8(%ebp),%eax
801010c1:	8b 40 10             	mov    0x10(%eax),%eax
801010c4:	89 04 24             	mov    %eax,(%esp)
801010c7:	e8 b4 07 00 00       	call   80101880 <ilock>
    stati(f->ip, st);
801010cc:	8b 45 08             	mov    0x8(%ebp),%eax
801010cf:	8b 40 10             	mov    0x10(%eax),%eax
801010d2:	8b 55 0c             	mov    0xc(%ebp),%edx
801010d5:	89 54 24 04          	mov    %edx,0x4(%esp)
801010d9:	89 04 24             	mov    %eax,(%esp)
801010dc:	e8 53 0c 00 00       	call   80101d34 <stati>
    iunlock(f->ip);
801010e1:	8b 45 08             	mov    0x8(%ebp),%eax
801010e4:	8b 40 10             	mov    0x10(%eax),%eax
801010e7:	89 04 24             	mov    %eax,(%esp)
801010ea:	e8 cb 08 00 00       	call   801019ba <iunlock>
    return 0;
801010ef:	b8 00 00 00 00       	mov    $0x0,%eax
801010f4:	eb 05                	jmp    801010fb <filestat+0x4d>
  }
  return -1;
801010f6:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
801010fb:	c9                   	leave  
801010fc:	c3                   	ret    

801010fd <fileread>:

// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
801010fd:	55                   	push   %ebp
801010fe:	89 e5                	mov    %esp,%ebp
80101100:	83 ec 28             	sub    $0x28,%esp
  int r;

  if(f->readable == 0)
80101103:	8b 45 08             	mov    0x8(%ebp),%eax
80101106:	0f b6 40 08          	movzbl 0x8(%eax),%eax
8010110a:	84 c0                	test   %al,%al
8010110c:	75 0a                	jne    80101118 <fileread+0x1b>
    return -1;
8010110e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101113:	e9 9f 00 00 00       	jmp    801011b7 <fileread+0xba>
  if(f->type == FD_PIPE)
80101118:	8b 45 08             	mov    0x8(%ebp),%eax
8010111b:	8b 00                	mov    (%eax),%eax
8010111d:	83 f8 01             	cmp    $0x1,%eax
80101120:	75 1e                	jne    80101140 <fileread+0x43>
    return piperead(f->pipe, addr, n);
80101122:	8b 45 08             	mov    0x8(%ebp),%eax
80101125:	8b 40 0c             	mov    0xc(%eax),%eax
80101128:	8b 55 10             	mov    0x10(%ebp),%edx
8010112b:	89 54 24 08          	mov    %edx,0x8(%esp)
8010112f:	8b 55 0c             	mov    0xc(%ebp),%edx
80101132:	89 54 24 04          	mov    %edx,0x4(%esp)
80101136:	89 04 24             	mov    %eax,(%esp)
80101139:	e8 4d 2e 00 00       	call   80103f8b <piperead>
8010113e:	eb 77                	jmp    801011b7 <fileread+0xba>
  if(f->type == FD_INODE){
80101140:	8b 45 08             	mov    0x8(%ebp),%eax
80101143:	8b 00                	mov    (%eax),%eax
80101145:	83 f8 02             	cmp    $0x2,%eax
80101148:	75 61                	jne    801011ab <fileread+0xae>
    ilock(f->ip);
8010114a:	8b 45 08             	mov    0x8(%ebp),%eax
8010114d:	8b 40 10             	mov    0x10(%eax),%eax
80101150:	89 04 24             	mov    %eax,(%esp)
80101153:	e8 28 07 00 00       	call   80101880 <ilock>
    if((r = readi(f->ip, addr, f->off, n)) > 0)
80101158:	8b 4d 10             	mov    0x10(%ebp),%ecx
8010115b:	8b 45 08             	mov    0x8(%ebp),%eax
8010115e:	8b 50 14             	mov    0x14(%eax),%edx
80101161:	8b 45 08             	mov    0x8(%ebp),%eax
80101164:	8b 40 10             	mov    0x10(%eax),%eax
80101167:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
8010116b:	89 54 24 08          	mov    %edx,0x8(%esp)
8010116f:	8b 55 0c             	mov    0xc(%ebp),%edx
80101172:	89 54 24 04          	mov    %edx,0x4(%esp)
80101176:	89 04 24             	mov    %eax,(%esp)
80101179:	e8 fb 0b 00 00       	call   80101d79 <readi>
8010117e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101181:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101185:	7e 11                	jle    80101198 <fileread+0x9b>
      f->off += r;
80101187:	8b 45 08             	mov    0x8(%ebp),%eax
8010118a:	8b 50 14             	mov    0x14(%eax),%edx
8010118d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101190:	01 c2                	add    %eax,%edx
80101192:	8b 45 08             	mov    0x8(%ebp),%eax
80101195:	89 50 14             	mov    %edx,0x14(%eax)
    iunlock(f->ip);
80101198:	8b 45 08             	mov    0x8(%ebp),%eax
8010119b:	8b 40 10             	mov    0x10(%eax),%eax
8010119e:	89 04 24             	mov    %eax,(%esp)
801011a1:	e8 14 08 00 00       	call   801019ba <iunlock>
    return r;
801011a6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801011a9:	eb 0c                	jmp    801011b7 <fileread+0xba>
  }
  panic("fileread");
801011ab:	c7 04 24 9e 93 10 80 	movl   $0x8010939e,(%esp)
801011b2:	e8 7b f3 ff ff       	call   80100532 <panic>
}
801011b7:	c9                   	leave  
801011b8:	c3                   	ret    

801011b9 <filewrite>:

//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
801011b9:	55                   	push   %ebp
801011ba:	89 e5                	mov    %esp,%ebp
801011bc:	53                   	push   %ebx
801011bd:	83 ec 24             	sub    $0x24,%esp
  int r;

  if(f->writable == 0)
801011c0:	8b 45 08             	mov    0x8(%ebp),%eax
801011c3:	0f b6 40 09          	movzbl 0x9(%eax),%eax
801011c7:	84 c0                	test   %al,%al
801011c9:	75 0a                	jne    801011d5 <filewrite+0x1c>
    return -1;
801011cb:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801011d0:	e9 23 01 00 00       	jmp    801012f8 <filewrite+0x13f>
  if(f->type == FD_PIPE)
801011d5:	8b 45 08             	mov    0x8(%ebp),%eax
801011d8:	8b 00                	mov    (%eax),%eax
801011da:	83 f8 01             	cmp    $0x1,%eax
801011dd:	75 21                	jne    80101200 <filewrite+0x47>
    return pipewrite(f->pipe, addr, n);
801011df:	8b 45 08             	mov    0x8(%ebp),%eax
801011e2:	8b 40 0c             	mov    0xc(%eax),%eax
801011e5:	8b 55 10             	mov    0x10(%ebp),%edx
801011e8:	89 54 24 08          	mov    %edx,0x8(%esp)
801011ec:	8b 55 0c             	mov    0xc(%ebp),%edx
801011ef:	89 54 24 04          	mov    %edx,0x4(%esp)
801011f3:	89 04 24             	mov    %eax,(%esp)
801011f6:	e8 9e 2c 00 00       	call   80103e99 <pipewrite>
801011fb:	e9 f8 00 00 00       	jmp    801012f8 <filewrite+0x13f>
  if(f->type == FD_INODE){
80101200:	8b 45 08             	mov    0x8(%ebp),%eax
80101203:	8b 00                	mov    (%eax),%eax
80101205:	83 f8 02             	cmp    $0x2,%eax
80101208:	0f 85 de 00 00 00    	jne    801012ec <filewrite+0x133>
    // the maximum log transaction size, including
    // i-node, indirect block, allocation blocks,
    // and 2 blocks of slop for non-aligned writes.
    // this really belongs lower down, since writei()
    // might be writing a device like the console.
    int max = ((LOGSIZE-1-1-2) / 2) * 512;
8010120e:	c7 45 ec 00 06 00 00 	movl   $0x600,-0x14(%ebp)
    int i = 0;
80101215:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while(i < n){
8010121c:	e9 a8 00 00 00       	jmp    801012c9 <filewrite+0x110>
      int n1 = n - i;
80101221:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101224:	8b 55 10             	mov    0x10(%ebp),%edx
80101227:	89 d1                	mov    %edx,%ecx
80101229:	29 c1                	sub    %eax,%ecx
8010122b:	89 c8                	mov    %ecx,%eax
8010122d:	89 45 f0             	mov    %eax,-0x10(%ebp)
      if(n1 > max)
80101230:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101233:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80101236:	7e 06                	jle    8010123e <filewrite+0x85>
        n1 = max;
80101238:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010123b:	89 45 f0             	mov    %eax,-0x10(%ebp)

      begin_trans();
8010123e:	e8 49 20 00 00       	call   8010328c <begin_trans>
      ilock(f->ip);
80101243:	8b 45 08             	mov    0x8(%ebp),%eax
80101246:	8b 40 10             	mov    0x10(%eax),%eax
80101249:	89 04 24             	mov    %eax,(%esp)
8010124c:	e8 2f 06 00 00       	call   80101880 <ilock>
      if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101251:	8b 4d f0             	mov    -0x10(%ebp),%ecx
80101254:	8b 45 08             	mov    0x8(%ebp),%eax
80101257:	8b 50 14             	mov    0x14(%eax),%edx
8010125a:	8b 5d f4             	mov    -0xc(%ebp),%ebx
8010125d:	8b 45 0c             	mov    0xc(%ebp),%eax
80101260:	01 c3                	add    %eax,%ebx
80101262:	8b 45 08             	mov    0x8(%ebp),%eax
80101265:	8b 40 10             	mov    0x10(%eax),%eax
80101268:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
8010126c:	89 54 24 08          	mov    %edx,0x8(%esp)
80101270:	89 5c 24 04          	mov    %ebx,0x4(%esp)
80101274:	89 04 24             	mov    %eax,(%esp)
80101277:	e8 6b 0c 00 00       	call   80101ee7 <writei>
8010127c:	89 45 e8             	mov    %eax,-0x18(%ebp)
8010127f:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
80101283:	7e 11                	jle    80101296 <filewrite+0xdd>
        f->off += r;
80101285:	8b 45 08             	mov    0x8(%ebp),%eax
80101288:	8b 50 14             	mov    0x14(%eax),%edx
8010128b:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010128e:	01 c2                	add    %eax,%edx
80101290:	8b 45 08             	mov    0x8(%ebp),%eax
80101293:	89 50 14             	mov    %edx,0x14(%eax)
      iunlock(f->ip);
80101296:	8b 45 08             	mov    0x8(%ebp),%eax
80101299:	8b 40 10             	mov    0x10(%eax),%eax
8010129c:	89 04 24             	mov    %eax,(%esp)
8010129f:	e8 16 07 00 00       	call   801019ba <iunlock>
      commit_trans();
801012a4:	e8 2c 20 00 00       	call   801032d5 <commit_trans>

      if(r < 0)
801012a9:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801012ad:	78 28                	js     801012d7 <filewrite+0x11e>
        break;
      if(r != n1)
801012af:	8b 45 e8             	mov    -0x18(%ebp),%eax
801012b2:	3b 45 f0             	cmp    -0x10(%ebp),%eax
801012b5:	74 0c                	je     801012c3 <filewrite+0x10a>
        panic("short filewrite");
801012b7:	c7 04 24 a7 93 10 80 	movl   $0x801093a7,(%esp)
801012be:	e8 6f f2 ff ff       	call   80100532 <panic>
      i += r;
801012c3:	8b 45 e8             	mov    -0x18(%ebp),%eax
801012c6:	01 45 f4             	add    %eax,-0xc(%ebp)
    // and 2 blocks of slop for non-aligned writes.
    // this really belongs lower down, since writei()
    // might be writing a device like the console.
    int max = ((LOGSIZE-1-1-2) / 2) * 512;
    int i = 0;
    while(i < n){
801012c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801012cc:	3b 45 10             	cmp    0x10(%ebp),%eax
801012cf:	0f 8c 4c ff ff ff    	jl     80101221 <filewrite+0x68>
801012d5:	eb 01                	jmp    801012d8 <filewrite+0x11f>
        f->off += r;
      iunlock(f->ip);
      commit_trans();

      if(r < 0)
        break;
801012d7:	90                   	nop
      if(r != n1)
        panic("short filewrite");
      i += r;
    }
    return i == n ? n : -1;
801012d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801012db:	3b 45 10             	cmp    0x10(%ebp),%eax
801012de:	75 05                	jne    801012e5 <filewrite+0x12c>
801012e0:	8b 45 10             	mov    0x10(%ebp),%eax
801012e3:	eb 05                	jmp    801012ea <filewrite+0x131>
801012e5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801012ea:	eb 0c                	jmp    801012f8 <filewrite+0x13f>
  }
  panic("filewrite");
801012ec:	c7 04 24 b7 93 10 80 	movl   $0x801093b7,(%esp)
801012f3:	e8 3a f2 ff ff       	call   80100532 <panic>
}
801012f8:	83 c4 24             	add    $0x24,%esp
801012fb:	5b                   	pop    %ebx
801012fc:	5d                   	pop    %ebp
801012fd:	c3                   	ret    
801012fe:	66 90                	xchg   %ax,%ax

80101300 <readsb>:


// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
80101300:	55                   	push   %ebp
80101301:	89 e5                	mov    %esp,%ebp
80101303:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  
  bp = bread(dev, 1);
80101306:	8b 45 08             	mov    0x8(%ebp),%eax
80101309:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80101310:	00 
80101311:	89 04 24             	mov    %eax,(%esp)
80101314:	e8 78 ee ff ff       	call   80100191 <bread>
80101319:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memmove(sb, bp->data, sizeof(*sb));
8010131c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010131f:	83 c0 18             	add    $0x18,%eax
80101322:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
80101329:	00 
8010132a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010132e:	8b 45 0c             	mov    0xc(%ebp),%eax
80101331:	89 04 24             	mov    %eax,(%esp)
80101334:	e8 fc 4b 00 00       	call   80105f35 <memmove>
  brelse(bp);
80101339:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010133c:	89 04 24             	mov    %eax,(%esp)
8010133f:	e8 be ee ff ff       	call   80100202 <brelse>
}
80101344:	c9                   	leave  
80101345:	c3                   	ret    

80101346 <bzero>:

// Zero a block.
static void
bzero(int dev, int bno)
{
80101346:	55                   	push   %ebp
80101347:	89 e5                	mov    %esp,%ebp
80101349:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  
  bp = bread(dev, bno);
8010134c:	8b 55 0c             	mov    0xc(%ebp),%edx
8010134f:	8b 45 08             	mov    0x8(%ebp),%eax
80101352:	89 54 24 04          	mov    %edx,0x4(%esp)
80101356:	89 04 24             	mov    %eax,(%esp)
80101359:	e8 33 ee ff ff       	call   80100191 <bread>
8010135e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memset(bp->data, 0, BSIZE);
80101361:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101364:	83 c0 18             	add    $0x18,%eax
80101367:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
8010136e:	00 
8010136f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80101376:	00 
80101377:	89 04 24             	mov    %eax,(%esp)
8010137a:	e8 e3 4a 00 00       	call   80105e62 <memset>
  log_write(bp);
8010137f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101382:	89 04 24             	mov    %eax,(%esp)
80101385:	e8 a3 1f 00 00       	call   8010332d <log_write>
  brelse(bp);
8010138a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010138d:	89 04 24             	mov    %eax,(%esp)
80101390:	e8 6d ee ff ff       	call   80100202 <brelse>
}
80101395:	c9                   	leave  
80101396:	c3                   	ret    

80101397 <balloc>:
// Blocks. 

// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
80101397:	55                   	push   %ebp
80101398:	89 e5                	mov    %esp,%ebp
8010139a:	53                   	push   %ebx
8010139b:	83 ec 34             	sub    $0x34,%esp
  int b, bi, m;
  struct buf *bp;
  struct superblock sb;

  bp = 0;
8010139e:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
  readsb(dev, &sb);
801013a5:	8b 45 08             	mov    0x8(%ebp),%eax
801013a8:	8d 55 d8             	lea    -0x28(%ebp),%edx
801013ab:	89 54 24 04          	mov    %edx,0x4(%esp)
801013af:	89 04 24             	mov    %eax,(%esp)
801013b2:	e8 49 ff ff ff       	call   80101300 <readsb>
  for(b = 0; b < sb.size; b += BPB){
801013b7:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801013be:	e9 0d 01 00 00       	jmp    801014d0 <balloc+0x139>
    bp = bread(dev, BBLOCK(b, sb.ninodes));
801013c3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801013c6:	8d 90 ff 0f 00 00    	lea    0xfff(%eax),%edx
801013cc:	85 c0                	test   %eax,%eax
801013ce:	0f 48 c2             	cmovs  %edx,%eax
801013d1:	c1 f8 0c             	sar    $0xc,%eax
801013d4:	8b 55 e0             	mov    -0x20(%ebp),%edx
801013d7:	c1 ea 03             	shr    $0x3,%edx
801013da:	01 d0                	add    %edx,%eax
801013dc:	83 c0 03             	add    $0x3,%eax
801013df:	89 44 24 04          	mov    %eax,0x4(%esp)
801013e3:	8b 45 08             	mov    0x8(%ebp),%eax
801013e6:	89 04 24             	mov    %eax,(%esp)
801013e9:	e8 a3 ed ff ff       	call   80100191 <bread>
801013ee:	89 45 ec             	mov    %eax,-0x14(%ebp)
    for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
801013f1:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
801013f8:	e9 a3 00 00 00       	jmp    801014a0 <balloc+0x109>
      m = 1 << (bi % 8);
801013fd:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101400:	89 c2                	mov    %eax,%edx
80101402:	c1 fa 1f             	sar    $0x1f,%edx
80101405:	c1 ea 1d             	shr    $0x1d,%edx
80101408:	01 d0                	add    %edx,%eax
8010140a:	83 e0 07             	and    $0x7,%eax
8010140d:	29 d0                	sub    %edx,%eax
8010140f:	ba 01 00 00 00       	mov    $0x1,%edx
80101414:	89 d3                	mov    %edx,%ebx
80101416:	89 c1                	mov    %eax,%ecx
80101418:	d3 e3                	shl    %cl,%ebx
8010141a:	89 d8                	mov    %ebx,%eax
8010141c:	89 45 e8             	mov    %eax,-0x18(%ebp)
      if((bp->data[bi/8] & m) == 0){  // Is block free?
8010141f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101422:	8d 50 07             	lea    0x7(%eax),%edx
80101425:	85 c0                	test   %eax,%eax
80101427:	0f 48 c2             	cmovs  %edx,%eax
8010142a:	c1 f8 03             	sar    $0x3,%eax
8010142d:	8b 55 ec             	mov    -0x14(%ebp),%edx
80101430:	0f b6 44 02 18       	movzbl 0x18(%edx,%eax,1),%eax
80101435:	0f b6 c0             	movzbl %al,%eax
80101438:	23 45 e8             	and    -0x18(%ebp),%eax
8010143b:	85 c0                	test   %eax,%eax
8010143d:	75 5d                	jne    8010149c <balloc+0x105>
        bp->data[bi/8] |= m;  // Mark block in use.
8010143f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101442:	8d 50 07             	lea    0x7(%eax),%edx
80101445:	85 c0                	test   %eax,%eax
80101447:	0f 48 c2             	cmovs  %edx,%eax
8010144a:	c1 f8 03             	sar    $0x3,%eax
8010144d:	8b 55 ec             	mov    -0x14(%ebp),%edx
80101450:	0f b6 54 02 18       	movzbl 0x18(%edx,%eax,1),%edx
80101455:	89 d1                	mov    %edx,%ecx
80101457:	8b 55 e8             	mov    -0x18(%ebp),%edx
8010145a:	09 ca                	or     %ecx,%edx
8010145c:	89 d1                	mov    %edx,%ecx
8010145e:	8b 55 ec             	mov    -0x14(%ebp),%edx
80101461:	88 4c 02 18          	mov    %cl,0x18(%edx,%eax,1)
        log_write(bp);
80101465:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101468:	89 04 24             	mov    %eax,(%esp)
8010146b:	e8 bd 1e 00 00       	call   8010332d <log_write>
        brelse(bp);
80101470:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101473:	89 04 24             	mov    %eax,(%esp)
80101476:	e8 87 ed ff ff       	call   80100202 <brelse>
        bzero(dev, b + bi);
8010147b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010147e:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101481:	01 c2                	add    %eax,%edx
80101483:	8b 45 08             	mov    0x8(%ebp),%eax
80101486:	89 54 24 04          	mov    %edx,0x4(%esp)
8010148a:	89 04 24             	mov    %eax,(%esp)
8010148d:	e8 b4 fe ff ff       	call   80101346 <bzero>
        return b + bi;
80101492:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101495:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101498:	01 d0                	add    %edx,%eax
8010149a:	eb 4e                	jmp    801014ea <balloc+0x153>

  bp = 0;
  readsb(dev, &sb);
  for(b = 0; b < sb.size; b += BPB){
    bp = bread(dev, BBLOCK(b, sb.ninodes));
    for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
8010149c:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
801014a0:	81 7d f0 ff 0f 00 00 	cmpl   $0xfff,-0x10(%ebp)
801014a7:	7f 15                	jg     801014be <balloc+0x127>
801014a9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801014ac:	8b 55 f4             	mov    -0xc(%ebp),%edx
801014af:	01 d0                	add    %edx,%eax
801014b1:	89 c2                	mov    %eax,%edx
801014b3:	8b 45 d8             	mov    -0x28(%ebp),%eax
801014b6:	39 c2                	cmp    %eax,%edx
801014b8:	0f 82 3f ff ff ff    	jb     801013fd <balloc+0x66>
        brelse(bp);
        bzero(dev, b + bi);
        return b + bi;
      }
    }
    brelse(bp);
801014be:	8b 45 ec             	mov    -0x14(%ebp),%eax
801014c1:	89 04 24             	mov    %eax,(%esp)
801014c4:	e8 39 ed ff ff       	call   80100202 <brelse>
  struct buf *bp;
  struct superblock sb;

  bp = 0;
  readsb(dev, &sb);
  for(b = 0; b < sb.size; b += BPB){
801014c9:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801014d0:	8b 55 f4             	mov    -0xc(%ebp),%edx
801014d3:	8b 45 d8             	mov    -0x28(%ebp),%eax
801014d6:	39 c2                	cmp    %eax,%edx
801014d8:	0f 82 e5 fe ff ff    	jb     801013c3 <balloc+0x2c>
        return b + bi;
      }
    }
    brelse(bp);
  }
  panic("balloc: out of blocks");
801014de:	c7 04 24 c1 93 10 80 	movl   $0x801093c1,(%esp)
801014e5:	e8 48 f0 ff ff       	call   80100532 <panic>
}
801014ea:	83 c4 34             	add    $0x34,%esp
801014ed:	5b                   	pop    %ebx
801014ee:	5d                   	pop    %ebp
801014ef:	c3                   	ret    

801014f0 <bfree>:

// Free a disk block.
static void
bfree(int dev, uint b)
{
801014f0:	55                   	push   %ebp
801014f1:	89 e5                	mov    %esp,%ebp
801014f3:	53                   	push   %ebx
801014f4:	83 ec 34             	sub    $0x34,%esp
  struct buf *bp;
  struct superblock sb;
  int bi, m;

  readsb(dev, &sb);
801014f7:	8d 45 dc             	lea    -0x24(%ebp),%eax
801014fa:	89 44 24 04          	mov    %eax,0x4(%esp)
801014fe:	8b 45 08             	mov    0x8(%ebp),%eax
80101501:	89 04 24             	mov    %eax,(%esp)
80101504:	e8 f7 fd ff ff       	call   80101300 <readsb>
  bp = bread(dev, BBLOCK(b, sb.ninodes));
80101509:	8b 45 0c             	mov    0xc(%ebp),%eax
8010150c:	89 c2                	mov    %eax,%edx
8010150e:	c1 ea 0c             	shr    $0xc,%edx
80101511:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80101514:	c1 e8 03             	shr    $0x3,%eax
80101517:	01 d0                	add    %edx,%eax
80101519:	8d 50 03             	lea    0x3(%eax),%edx
8010151c:	8b 45 08             	mov    0x8(%ebp),%eax
8010151f:	89 54 24 04          	mov    %edx,0x4(%esp)
80101523:	89 04 24             	mov    %eax,(%esp)
80101526:	e8 66 ec ff ff       	call   80100191 <bread>
8010152b:	89 45 f4             	mov    %eax,-0xc(%ebp)
  bi = b % BPB;
8010152e:	8b 45 0c             	mov    0xc(%ebp),%eax
80101531:	25 ff 0f 00 00       	and    $0xfff,%eax
80101536:	89 45 f0             	mov    %eax,-0x10(%ebp)
  m = 1 << (bi % 8);
80101539:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010153c:	89 c2                	mov    %eax,%edx
8010153e:	c1 fa 1f             	sar    $0x1f,%edx
80101541:	c1 ea 1d             	shr    $0x1d,%edx
80101544:	01 d0                	add    %edx,%eax
80101546:	83 e0 07             	and    $0x7,%eax
80101549:	29 d0                	sub    %edx,%eax
8010154b:	ba 01 00 00 00       	mov    $0x1,%edx
80101550:	89 d3                	mov    %edx,%ebx
80101552:	89 c1                	mov    %eax,%ecx
80101554:	d3 e3                	shl    %cl,%ebx
80101556:	89 d8                	mov    %ebx,%eax
80101558:	89 45 ec             	mov    %eax,-0x14(%ebp)
  if((bp->data[bi/8] & m) == 0)
8010155b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010155e:	8d 50 07             	lea    0x7(%eax),%edx
80101561:	85 c0                	test   %eax,%eax
80101563:	0f 48 c2             	cmovs  %edx,%eax
80101566:	c1 f8 03             	sar    $0x3,%eax
80101569:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010156c:	0f b6 44 02 18       	movzbl 0x18(%edx,%eax,1),%eax
80101571:	0f b6 c0             	movzbl %al,%eax
80101574:	23 45 ec             	and    -0x14(%ebp),%eax
80101577:	85 c0                	test   %eax,%eax
80101579:	75 0c                	jne    80101587 <bfree+0x97>
    panic("freeing free block");
8010157b:	c7 04 24 d7 93 10 80 	movl   $0x801093d7,(%esp)
80101582:	e8 ab ef ff ff       	call   80100532 <panic>
  bp->data[bi/8] &= ~m;
80101587:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010158a:	8d 50 07             	lea    0x7(%eax),%edx
8010158d:	85 c0                	test   %eax,%eax
8010158f:	0f 48 c2             	cmovs  %edx,%eax
80101592:	c1 f8 03             	sar    $0x3,%eax
80101595:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101598:	0f b6 54 02 18       	movzbl 0x18(%edx,%eax,1),%edx
8010159d:	8b 4d ec             	mov    -0x14(%ebp),%ecx
801015a0:	f7 d1                	not    %ecx
801015a2:	21 ca                	and    %ecx,%edx
801015a4:	89 d1                	mov    %edx,%ecx
801015a6:	8b 55 f4             	mov    -0xc(%ebp),%edx
801015a9:	88 4c 02 18          	mov    %cl,0x18(%edx,%eax,1)
  log_write(bp);
801015ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
801015b0:	89 04 24             	mov    %eax,(%esp)
801015b3:	e8 75 1d 00 00       	call   8010332d <log_write>
  brelse(bp);
801015b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801015bb:	89 04 24             	mov    %eax,(%esp)
801015be:	e8 3f ec ff ff       	call   80100202 <brelse>
}
801015c3:	83 c4 34             	add    $0x34,%esp
801015c6:	5b                   	pop    %ebx
801015c7:	5d                   	pop    %ebp
801015c8:	c3                   	ret    

801015c9 <iinit>:
  struct inode inode[NINODE];
} icache;

void
iinit(void)
{
801015c9:	55                   	push   %ebp
801015ca:	89 e5                	mov    %esp,%ebp
801015cc:	83 ec 18             	sub    $0x18,%esp
  initlock(&icache.lock, "icache");
801015cf:	c7 44 24 04 ea 93 10 	movl   $0x801093ea,0x4(%esp)
801015d6:	80 
801015d7:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
801015de:	e8 03 46 00 00       	call   80105be6 <initlock>
}
801015e3:	c9                   	leave  
801015e4:	c3                   	ret    

801015e5 <ialloc>:
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode*
ialloc(uint dev, short type)
{
801015e5:	55                   	push   %ebp
801015e6:	89 e5                	mov    %esp,%ebp
801015e8:	83 ec 48             	sub    $0x48,%esp
801015eb:	8b 45 0c             	mov    0xc(%ebp),%eax
801015ee:	66 89 45 d4          	mov    %ax,-0x2c(%ebp)
  int inum;
  struct buf *bp;
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);
801015f2:	8b 45 08             	mov    0x8(%ebp),%eax
801015f5:	8d 55 dc             	lea    -0x24(%ebp),%edx
801015f8:	89 54 24 04          	mov    %edx,0x4(%esp)
801015fc:	89 04 24             	mov    %eax,(%esp)
801015ff:	e8 fc fc ff ff       	call   80101300 <readsb>

  for(inum = 1; inum < sb.ninodes; inum++){
80101604:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
8010160b:	e9 98 00 00 00       	jmp    801016a8 <ialloc+0xc3>
    bp = bread(dev, IBLOCK(inum));
80101610:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101613:	c1 e8 03             	shr    $0x3,%eax
80101616:	83 c0 02             	add    $0x2,%eax
80101619:	89 44 24 04          	mov    %eax,0x4(%esp)
8010161d:	8b 45 08             	mov    0x8(%ebp),%eax
80101620:	89 04 24             	mov    %eax,(%esp)
80101623:	e8 69 eb ff ff       	call   80100191 <bread>
80101628:	89 45 f0             	mov    %eax,-0x10(%ebp)
    dip = (struct dinode*)bp->data + inum%IPB;
8010162b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010162e:	8d 50 18             	lea    0x18(%eax),%edx
80101631:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101634:	83 e0 07             	and    $0x7,%eax
80101637:	c1 e0 06             	shl    $0x6,%eax
8010163a:	01 d0                	add    %edx,%eax
8010163c:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if(dip->type == 0){  // a free inode
8010163f:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101642:	0f b7 00             	movzwl (%eax),%eax
80101645:	66 85 c0             	test   %ax,%ax
80101648:	75 4f                	jne    80101699 <ialloc+0xb4>
      memset(dip, 0, sizeof(*dip));
8010164a:	c7 44 24 08 40 00 00 	movl   $0x40,0x8(%esp)
80101651:	00 
80101652:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80101659:	00 
8010165a:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010165d:	89 04 24             	mov    %eax,(%esp)
80101660:	e8 fd 47 00 00       	call   80105e62 <memset>
      dip->type = type;
80101665:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101668:	0f b7 55 d4          	movzwl -0x2c(%ebp),%edx
8010166c:	66 89 10             	mov    %dx,(%eax)
      log_write(bp);   // mark it allocated on the disk
8010166f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101672:	89 04 24             	mov    %eax,(%esp)
80101675:	e8 b3 1c 00 00       	call   8010332d <log_write>
      brelse(bp);
8010167a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010167d:	89 04 24             	mov    %eax,(%esp)
80101680:	e8 7d eb ff ff       	call   80100202 <brelse>
      return iget(dev, inum);
80101685:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101688:	89 44 24 04          	mov    %eax,0x4(%esp)
8010168c:	8b 45 08             	mov    0x8(%ebp),%eax
8010168f:	89 04 24             	mov    %eax,(%esp)
80101692:	e8 e5 00 00 00       	call   8010177c <iget>
80101697:	eb 29                	jmp    801016c2 <ialloc+0xdd>
    }
    brelse(bp);
80101699:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010169c:	89 04 24             	mov    %eax,(%esp)
8010169f:	e8 5e eb ff ff       	call   80100202 <brelse>
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);

  for(inum = 1; inum < sb.ninodes; inum++){
801016a4:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801016a8:	8b 55 f4             	mov    -0xc(%ebp),%edx
801016ab:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801016ae:	39 c2                	cmp    %eax,%edx
801016b0:	0f 82 5a ff ff ff    	jb     80101610 <ialloc+0x2b>
      brelse(bp);
      return iget(dev, inum);
    }
    brelse(bp);
  }
  panic("ialloc: no inodes");
801016b6:	c7 04 24 f1 93 10 80 	movl   $0x801093f1,(%esp)
801016bd:	e8 70 ee ff ff       	call   80100532 <panic>
}
801016c2:	c9                   	leave  
801016c3:	c3                   	ret    

801016c4 <iupdate>:

// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
801016c4:	55                   	push   %ebp
801016c5:	89 e5                	mov    %esp,%ebp
801016c7:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  struct dinode *dip;

  bp = bread(ip->dev, IBLOCK(ip->inum));
801016ca:	8b 45 08             	mov    0x8(%ebp),%eax
801016cd:	8b 40 04             	mov    0x4(%eax),%eax
801016d0:	c1 e8 03             	shr    $0x3,%eax
801016d3:	8d 50 02             	lea    0x2(%eax),%edx
801016d6:	8b 45 08             	mov    0x8(%ebp),%eax
801016d9:	8b 00                	mov    (%eax),%eax
801016db:	89 54 24 04          	mov    %edx,0x4(%esp)
801016df:	89 04 24             	mov    %eax,(%esp)
801016e2:	e8 aa ea ff ff       	call   80100191 <bread>
801016e7:	89 45 f4             	mov    %eax,-0xc(%ebp)
  dip = (struct dinode*)bp->data + ip->inum%IPB;
801016ea:	8b 45 f4             	mov    -0xc(%ebp),%eax
801016ed:	8d 50 18             	lea    0x18(%eax),%edx
801016f0:	8b 45 08             	mov    0x8(%ebp),%eax
801016f3:	8b 40 04             	mov    0x4(%eax),%eax
801016f6:	83 e0 07             	and    $0x7,%eax
801016f9:	c1 e0 06             	shl    $0x6,%eax
801016fc:	01 d0                	add    %edx,%eax
801016fe:	89 45 f0             	mov    %eax,-0x10(%ebp)
  dip->type = ip->type;
80101701:	8b 45 08             	mov    0x8(%ebp),%eax
80101704:	0f b7 50 10          	movzwl 0x10(%eax),%edx
80101708:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010170b:	66 89 10             	mov    %dx,(%eax)
  dip->major = ip->major;
8010170e:	8b 45 08             	mov    0x8(%ebp),%eax
80101711:	0f b7 50 12          	movzwl 0x12(%eax),%edx
80101715:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101718:	66 89 50 02          	mov    %dx,0x2(%eax)
  dip->minor = ip->minor;
8010171c:	8b 45 08             	mov    0x8(%ebp),%eax
8010171f:	0f b7 50 14          	movzwl 0x14(%eax),%edx
80101723:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101726:	66 89 50 04          	mov    %dx,0x4(%eax)
  dip->nlink = ip->nlink;
8010172a:	8b 45 08             	mov    0x8(%ebp),%eax
8010172d:	0f b7 50 16          	movzwl 0x16(%eax),%edx
80101731:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101734:	66 89 50 06          	mov    %dx,0x6(%eax)
  dip->size = ip->size;
80101738:	8b 45 08             	mov    0x8(%ebp),%eax
8010173b:	8b 50 18             	mov    0x18(%eax),%edx
8010173e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101741:	89 50 08             	mov    %edx,0x8(%eax)
  memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
80101744:	8b 45 08             	mov    0x8(%ebp),%eax
80101747:	8d 50 1c             	lea    0x1c(%eax),%edx
8010174a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010174d:	83 c0 0c             	add    $0xc,%eax
80101750:	c7 44 24 08 34 00 00 	movl   $0x34,0x8(%esp)
80101757:	00 
80101758:	89 54 24 04          	mov    %edx,0x4(%esp)
8010175c:	89 04 24             	mov    %eax,(%esp)
8010175f:	e8 d1 47 00 00       	call   80105f35 <memmove>
  log_write(bp);
80101764:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101767:	89 04 24             	mov    %eax,(%esp)
8010176a:	e8 be 1b 00 00       	call   8010332d <log_write>
  brelse(bp);
8010176f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101772:	89 04 24             	mov    %eax,(%esp)
80101775:	e8 88 ea ff ff       	call   80100202 <brelse>
}
8010177a:	c9                   	leave  
8010177b:	c3                   	ret    

8010177c <iget>:
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
8010177c:	55                   	push   %ebp
8010177d:	89 e5                	mov    %esp,%ebp
8010177f:	83 ec 28             	sub    $0x28,%esp
  struct inode *ip, *empty;

  acquire(&icache.lock);
80101782:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80101789:	e8 79 44 00 00       	call   80105c07 <acquire>

  // Is the inode already cached?
  empty = 0;
8010178e:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
80101795:	c7 45 f4 f4 f8 10 80 	movl   $0x8010f8f4,-0xc(%ebp)
8010179c:	eb 59                	jmp    801017f7 <iget+0x7b>
    if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
8010179e:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017a1:	8b 40 08             	mov    0x8(%eax),%eax
801017a4:	85 c0                	test   %eax,%eax
801017a6:	7e 35                	jle    801017dd <iget+0x61>
801017a8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017ab:	8b 00                	mov    (%eax),%eax
801017ad:	3b 45 08             	cmp    0x8(%ebp),%eax
801017b0:	75 2b                	jne    801017dd <iget+0x61>
801017b2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017b5:	8b 40 04             	mov    0x4(%eax),%eax
801017b8:	3b 45 0c             	cmp    0xc(%ebp),%eax
801017bb:	75 20                	jne    801017dd <iget+0x61>
      ip->ref++;
801017bd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017c0:	8b 40 08             	mov    0x8(%eax),%eax
801017c3:	8d 50 01             	lea    0x1(%eax),%edx
801017c6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017c9:	89 50 08             	mov    %edx,0x8(%eax)
      release(&icache.lock);
801017cc:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
801017d3:	e8 91 44 00 00       	call   80105c69 <release>
      return ip;
801017d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017db:	eb 6f                	jmp    8010184c <iget+0xd0>
    }
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
801017dd:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801017e1:	75 10                	jne    801017f3 <iget+0x77>
801017e3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017e6:	8b 40 08             	mov    0x8(%eax),%eax
801017e9:	85 c0                	test   %eax,%eax
801017eb:	75 06                	jne    801017f3 <iget+0x77>
      empty = ip;
801017ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017f0:	89 45 f0             	mov    %eax,-0x10(%ebp)

  acquire(&icache.lock);

  // Is the inode already cached?
  empty = 0;
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
801017f3:	83 45 f4 50          	addl   $0x50,-0xc(%ebp)
801017f7:	81 7d f4 94 08 11 80 	cmpl   $0x80110894,-0xc(%ebp)
801017fe:	72 9e                	jb     8010179e <iget+0x22>
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
      empty = ip;
  }

  // Recycle an inode cache entry.
  if(empty == 0)
80101800:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80101804:	75 0c                	jne    80101812 <iget+0x96>
    panic("iget: no inodes");
80101806:	c7 04 24 03 94 10 80 	movl   $0x80109403,(%esp)
8010180d:	e8 20 ed ff ff       	call   80100532 <panic>

  ip = empty;
80101812:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101815:	89 45 f4             	mov    %eax,-0xc(%ebp)
  ip->dev = dev;
80101818:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010181b:	8b 55 08             	mov    0x8(%ebp),%edx
8010181e:	89 10                	mov    %edx,(%eax)
  ip->inum = inum;
80101820:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101823:	8b 55 0c             	mov    0xc(%ebp),%edx
80101826:	89 50 04             	mov    %edx,0x4(%eax)
  ip->ref = 1;
80101829:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010182c:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
  ip->flags = 0;
80101833:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101836:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
  release(&icache.lock);
8010183d:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80101844:	e8 20 44 00 00       	call   80105c69 <release>

  return ip;
80101849:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
8010184c:	c9                   	leave  
8010184d:	c3                   	ret    

8010184e <idup>:

// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
8010184e:	55                   	push   %ebp
8010184f:	89 e5                	mov    %esp,%ebp
80101851:	83 ec 18             	sub    $0x18,%esp
  acquire(&icache.lock);
80101854:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
8010185b:	e8 a7 43 00 00       	call   80105c07 <acquire>
  ip->ref++;
80101860:	8b 45 08             	mov    0x8(%ebp),%eax
80101863:	8b 40 08             	mov    0x8(%eax),%eax
80101866:	8d 50 01             	lea    0x1(%eax),%edx
80101869:	8b 45 08             	mov    0x8(%ebp),%eax
8010186c:	89 50 08             	mov    %edx,0x8(%eax)
  release(&icache.lock);
8010186f:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80101876:	e8 ee 43 00 00       	call   80105c69 <release>
  return ip;
8010187b:	8b 45 08             	mov    0x8(%ebp),%eax
}
8010187e:	c9                   	leave  
8010187f:	c3                   	ret    

80101880 <ilock>:

// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
80101880:	55                   	push   %ebp
80101881:	89 e5                	mov    %esp,%ebp
80101883:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  struct dinode *dip;

  if(ip == 0 || ip->ref < 1)
80101886:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010188a:	74 0a                	je     80101896 <ilock+0x16>
8010188c:	8b 45 08             	mov    0x8(%ebp),%eax
8010188f:	8b 40 08             	mov    0x8(%eax),%eax
80101892:	85 c0                	test   %eax,%eax
80101894:	7f 0c                	jg     801018a2 <ilock+0x22>
    panic("ilock");
80101896:	c7 04 24 13 94 10 80 	movl   $0x80109413,(%esp)
8010189d:	e8 90 ec ff ff       	call   80100532 <panic>

  acquire(&icache.lock);
801018a2:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
801018a9:	e8 59 43 00 00       	call   80105c07 <acquire>
  release(&icache.lock);
801018ae:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
801018b5:	e8 af 43 00 00       	call   80105c69 <release>
  while(ip->flags & I_BUSY){}
801018ba:	90                   	nop
801018bb:	8b 45 08             	mov    0x8(%ebp),%eax
801018be:	8b 40 0c             	mov    0xc(%eax),%eax
801018c1:	83 e0 01             	and    $0x1,%eax
801018c4:	85 c0                	test   %eax,%eax
801018c6:	75 f3                	jne    801018bb <ilock+0x3b>
  ip->flags |= I_BUSY;
801018c8:	8b 45 08             	mov    0x8(%ebp),%eax
801018cb:	8b 40 0c             	mov    0xc(%eax),%eax
801018ce:	89 c2                	mov    %eax,%edx
801018d0:	83 ca 01             	or     $0x1,%edx
801018d3:	8b 45 08             	mov    0x8(%ebp),%eax
801018d6:	89 50 0c             	mov    %edx,0xc(%eax)


  if(!(ip->flags & I_VALID)){
801018d9:	8b 45 08             	mov    0x8(%ebp),%eax
801018dc:	8b 40 0c             	mov    0xc(%eax),%eax
801018df:	83 e0 02             	and    $0x2,%eax
801018e2:	85 c0                	test   %eax,%eax
801018e4:	0f 85 ce 00 00 00    	jne    801019b8 <ilock+0x138>
    bp = bread(ip->dev, IBLOCK(ip->inum));
801018ea:	8b 45 08             	mov    0x8(%ebp),%eax
801018ed:	8b 40 04             	mov    0x4(%eax),%eax
801018f0:	c1 e8 03             	shr    $0x3,%eax
801018f3:	8d 50 02             	lea    0x2(%eax),%edx
801018f6:	8b 45 08             	mov    0x8(%ebp),%eax
801018f9:	8b 00                	mov    (%eax),%eax
801018fb:	89 54 24 04          	mov    %edx,0x4(%esp)
801018ff:	89 04 24             	mov    %eax,(%esp)
80101902:	e8 8a e8 ff ff       	call   80100191 <bread>
80101907:	89 45 f4             	mov    %eax,-0xc(%ebp)
    dip = (struct dinode*)bp->data + ip->inum%IPB;
8010190a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010190d:	8d 50 18             	lea    0x18(%eax),%edx
80101910:	8b 45 08             	mov    0x8(%ebp),%eax
80101913:	8b 40 04             	mov    0x4(%eax),%eax
80101916:	83 e0 07             	and    $0x7,%eax
80101919:	c1 e0 06             	shl    $0x6,%eax
8010191c:	01 d0                	add    %edx,%eax
8010191e:	89 45 f0             	mov    %eax,-0x10(%ebp)
    ip->type = dip->type;
80101921:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101924:	0f b7 10             	movzwl (%eax),%edx
80101927:	8b 45 08             	mov    0x8(%ebp),%eax
8010192a:	66 89 50 10          	mov    %dx,0x10(%eax)
    ip->major = dip->major;
8010192e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101931:	0f b7 50 02          	movzwl 0x2(%eax),%edx
80101935:	8b 45 08             	mov    0x8(%ebp),%eax
80101938:	66 89 50 12          	mov    %dx,0x12(%eax)
    ip->minor = dip->minor;
8010193c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010193f:	0f b7 50 04          	movzwl 0x4(%eax),%edx
80101943:	8b 45 08             	mov    0x8(%ebp),%eax
80101946:	66 89 50 14          	mov    %dx,0x14(%eax)
    ip->nlink = dip->nlink;
8010194a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010194d:	0f b7 50 06          	movzwl 0x6(%eax),%edx
80101951:	8b 45 08             	mov    0x8(%ebp),%eax
80101954:	66 89 50 16          	mov    %dx,0x16(%eax)
    ip->size = dip->size;
80101958:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010195b:	8b 50 08             	mov    0x8(%eax),%edx
8010195e:	8b 45 08             	mov    0x8(%ebp),%eax
80101961:	89 50 18             	mov    %edx,0x18(%eax)
    memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80101964:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101967:	8d 50 0c             	lea    0xc(%eax),%edx
8010196a:	8b 45 08             	mov    0x8(%ebp),%eax
8010196d:	83 c0 1c             	add    $0x1c,%eax
80101970:	c7 44 24 08 34 00 00 	movl   $0x34,0x8(%esp)
80101977:	00 
80101978:	89 54 24 04          	mov    %edx,0x4(%esp)
8010197c:	89 04 24             	mov    %eax,(%esp)
8010197f:	e8 b1 45 00 00       	call   80105f35 <memmove>
    brelse(bp);
80101984:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101987:	89 04 24             	mov    %eax,(%esp)
8010198a:	e8 73 e8 ff ff       	call   80100202 <brelse>
    ip->flags |= I_VALID;
8010198f:	8b 45 08             	mov    0x8(%ebp),%eax
80101992:	8b 40 0c             	mov    0xc(%eax),%eax
80101995:	89 c2                	mov    %eax,%edx
80101997:	83 ca 02             	or     $0x2,%edx
8010199a:	8b 45 08             	mov    0x8(%ebp),%eax
8010199d:	89 50 0c             	mov    %edx,0xc(%eax)
    if(ip->type == 0)
801019a0:	8b 45 08             	mov    0x8(%ebp),%eax
801019a3:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801019a7:	66 85 c0             	test   %ax,%ax
801019aa:	75 0c                	jne    801019b8 <ilock+0x138>
      panic("ilock: no type");
801019ac:	c7 04 24 19 94 10 80 	movl   $0x80109419,(%esp)
801019b3:	e8 7a eb ff ff       	call   80100532 <panic>
  }
}
801019b8:	c9                   	leave  
801019b9:	c3                   	ret    

801019ba <iunlock>:

// Unlock the given inode.
void
iunlock(struct inode *ip)
{
801019ba:	55                   	push   %ebp
801019bb:	89 e5                	mov    %esp,%ebp
801019bd:	83 ec 18             	sub    $0x18,%esp
  if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1)
801019c0:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
801019c4:	74 17                	je     801019dd <iunlock+0x23>
801019c6:	8b 45 08             	mov    0x8(%ebp),%eax
801019c9:	8b 40 0c             	mov    0xc(%eax),%eax
801019cc:	83 e0 01             	and    $0x1,%eax
801019cf:	85 c0                	test   %eax,%eax
801019d1:	74 0a                	je     801019dd <iunlock+0x23>
801019d3:	8b 45 08             	mov    0x8(%ebp),%eax
801019d6:	8b 40 08             	mov    0x8(%eax),%eax
801019d9:	85 c0                	test   %eax,%eax
801019db:	7f 0c                	jg     801019e9 <iunlock+0x2f>
    panic("iunlock");
801019dd:	c7 04 24 28 94 10 80 	movl   $0x80109428,(%esp)
801019e4:	e8 49 eb ff ff       	call   80100532 <panic>

  acquire(&icache.lock);
801019e9:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
801019f0:	e8 12 42 00 00       	call   80105c07 <acquire>
  ip->flags &= ~I_BUSY;
801019f5:	8b 45 08             	mov    0x8(%ebp),%eax
801019f8:	8b 40 0c             	mov    0xc(%eax),%eax
801019fb:	89 c2                	mov    %eax,%edx
801019fd:	83 e2 fe             	and    $0xfffffffe,%edx
80101a00:	8b 45 08             	mov    0x8(%ebp),%eax
80101a03:	89 50 0c             	mov    %edx,0xc(%eax)
  wakeup(ip);
80101a06:	8b 45 08             	mov    0x8(%ebp),%eax
80101a09:	89 04 24             	mov    %eax,(%esp)
80101a0c:	e8 04 31 00 00       	call   80104b15 <wakeup>
  release(&icache.lock);
80101a11:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80101a18:	e8 4c 42 00 00       	call   80105c69 <release>
}
80101a1d:	c9                   	leave  
80101a1e:	c3                   	ret    

80101a1f <iput>:
// be recycled.
// If that was the last reference and the inode has no links
// to it, free the inode (and its content) on disk.
void
iput(struct inode *ip)
{
80101a1f:	55                   	push   %ebp
80101a20:	89 e5                	mov    %esp,%ebp
80101a22:	83 ec 18             	sub    $0x18,%esp
  acquire(&icache.lock);
80101a25:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80101a2c:	e8 d6 41 00 00       	call   80105c07 <acquire>
  if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
80101a31:	8b 45 08             	mov    0x8(%ebp),%eax
80101a34:	8b 40 08             	mov    0x8(%eax),%eax
80101a37:	83 f8 01             	cmp    $0x1,%eax
80101a3a:	0f 85 93 00 00 00    	jne    80101ad3 <iput+0xb4>
80101a40:	8b 45 08             	mov    0x8(%ebp),%eax
80101a43:	8b 40 0c             	mov    0xc(%eax),%eax
80101a46:	83 e0 02             	and    $0x2,%eax
80101a49:	85 c0                	test   %eax,%eax
80101a4b:	0f 84 82 00 00 00    	je     80101ad3 <iput+0xb4>
80101a51:	8b 45 08             	mov    0x8(%ebp),%eax
80101a54:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80101a58:	66 85 c0             	test   %ax,%ax
80101a5b:	75 76                	jne    80101ad3 <iput+0xb4>
    // inode has no links: truncate and free inode.
    if(ip->flags & I_BUSY)
80101a5d:	8b 45 08             	mov    0x8(%ebp),%eax
80101a60:	8b 40 0c             	mov    0xc(%eax),%eax
80101a63:	83 e0 01             	and    $0x1,%eax
80101a66:	85 c0                	test   %eax,%eax
80101a68:	74 0c                	je     80101a76 <iput+0x57>
      panic("iput busy");
80101a6a:	c7 04 24 30 94 10 80 	movl   $0x80109430,(%esp)
80101a71:	e8 bc ea ff ff       	call   80100532 <panic>
    ip->flags |= I_BUSY;
80101a76:	8b 45 08             	mov    0x8(%ebp),%eax
80101a79:	8b 40 0c             	mov    0xc(%eax),%eax
80101a7c:	89 c2                	mov    %eax,%edx
80101a7e:	83 ca 01             	or     $0x1,%edx
80101a81:	8b 45 08             	mov    0x8(%ebp),%eax
80101a84:	89 50 0c             	mov    %edx,0xc(%eax)
    release(&icache.lock);
80101a87:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80101a8e:	e8 d6 41 00 00       	call   80105c69 <release>
    itrunc(ip);
80101a93:	8b 45 08             	mov    0x8(%ebp),%eax
80101a96:	89 04 24             	mov    %eax,(%esp)
80101a99:	e8 7d 01 00 00       	call   80101c1b <itrunc>
    ip->type = 0;
80101a9e:	8b 45 08             	mov    0x8(%ebp),%eax
80101aa1:	66 c7 40 10 00 00    	movw   $0x0,0x10(%eax)
    iupdate(ip);
80101aa7:	8b 45 08             	mov    0x8(%ebp),%eax
80101aaa:	89 04 24             	mov    %eax,(%esp)
80101aad:	e8 12 fc ff ff       	call   801016c4 <iupdate>
    acquire(&icache.lock);
80101ab2:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80101ab9:	e8 49 41 00 00       	call   80105c07 <acquire>
    ip->flags = 0;
80101abe:	8b 45 08             	mov    0x8(%ebp),%eax
80101ac1:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    wakeup(ip);
80101ac8:	8b 45 08             	mov    0x8(%ebp),%eax
80101acb:	89 04 24             	mov    %eax,(%esp)
80101ace:	e8 42 30 00 00       	call   80104b15 <wakeup>
  }
  ip->ref--;
80101ad3:	8b 45 08             	mov    0x8(%ebp),%eax
80101ad6:	8b 40 08             	mov    0x8(%eax),%eax
80101ad9:	8d 50 ff             	lea    -0x1(%eax),%edx
80101adc:	8b 45 08             	mov    0x8(%ebp),%eax
80101adf:	89 50 08             	mov    %edx,0x8(%eax)
  release(&icache.lock);
80101ae2:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80101ae9:	e8 7b 41 00 00       	call   80105c69 <release>
}
80101aee:	c9                   	leave  
80101aef:	c3                   	ret    

80101af0 <iunlockput>:

// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101af0:	55                   	push   %ebp
80101af1:	89 e5                	mov    %esp,%ebp
80101af3:	83 ec 18             	sub    $0x18,%esp
  iunlock(ip);
80101af6:	8b 45 08             	mov    0x8(%ebp),%eax
80101af9:	89 04 24             	mov    %eax,(%esp)
80101afc:	e8 b9 fe ff ff       	call   801019ba <iunlock>
  iput(ip);
80101b01:	8b 45 08             	mov    0x8(%ebp),%eax
80101b04:	89 04 24             	mov    %eax,(%esp)
80101b07:	e8 13 ff ff ff       	call   80101a1f <iput>
}
80101b0c:	c9                   	leave  
80101b0d:	c3                   	ret    

80101b0e <bmap>:

// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
80101b0e:	55                   	push   %ebp
80101b0f:	89 e5                	mov    %esp,%ebp
80101b11:	53                   	push   %ebx
80101b12:	83 ec 24             	sub    $0x24,%esp
  uint addr, *a;
  struct buf *bp;

  if(bn < NDIRECT){
80101b15:	83 7d 0c 0b          	cmpl   $0xb,0xc(%ebp)
80101b19:	77 3e                	ja     80101b59 <bmap+0x4b>
    if((addr = ip->addrs[bn]) == 0)
80101b1b:	8b 45 08             	mov    0x8(%ebp),%eax
80101b1e:	8b 55 0c             	mov    0xc(%ebp),%edx
80101b21:	83 c2 04             	add    $0x4,%edx
80101b24:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80101b28:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b2b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101b2f:	75 20                	jne    80101b51 <bmap+0x43>
      ip->addrs[bn] = addr = balloc(ip->dev);
80101b31:	8b 45 08             	mov    0x8(%ebp),%eax
80101b34:	8b 00                	mov    (%eax),%eax
80101b36:	89 04 24             	mov    %eax,(%esp)
80101b39:	e8 59 f8 ff ff       	call   80101397 <balloc>
80101b3e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b41:	8b 45 08             	mov    0x8(%ebp),%eax
80101b44:	8b 55 0c             	mov    0xc(%ebp),%edx
80101b47:	8d 4a 04             	lea    0x4(%edx),%ecx
80101b4a:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101b4d:	89 54 88 0c          	mov    %edx,0xc(%eax,%ecx,4)
    return addr;
80101b51:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101b54:	e9 bc 00 00 00       	jmp    80101c15 <bmap+0x107>
  }
  bn -= NDIRECT;
80101b59:	83 6d 0c 0c          	subl   $0xc,0xc(%ebp)

  if(bn < NINDIRECT){
80101b5d:	83 7d 0c 7f          	cmpl   $0x7f,0xc(%ebp)
80101b61:	0f 87 a2 00 00 00    	ja     80101c09 <bmap+0xfb>
    // Load indirect block, allocating if necessary.
    if((addr = ip->addrs[NDIRECT]) == 0)
80101b67:	8b 45 08             	mov    0x8(%ebp),%eax
80101b6a:	8b 40 4c             	mov    0x4c(%eax),%eax
80101b6d:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b70:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101b74:	75 19                	jne    80101b8f <bmap+0x81>
      ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101b76:	8b 45 08             	mov    0x8(%ebp),%eax
80101b79:	8b 00                	mov    (%eax),%eax
80101b7b:	89 04 24             	mov    %eax,(%esp)
80101b7e:	e8 14 f8 ff ff       	call   80101397 <balloc>
80101b83:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b86:	8b 45 08             	mov    0x8(%ebp),%eax
80101b89:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101b8c:	89 50 4c             	mov    %edx,0x4c(%eax)
    bp = bread(ip->dev, addr);
80101b8f:	8b 45 08             	mov    0x8(%ebp),%eax
80101b92:	8b 00                	mov    (%eax),%eax
80101b94:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101b97:	89 54 24 04          	mov    %edx,0x4(%esp)
80101b9b:	89 04 24             	mov    %eax,(%esp)
80101b9e:	e8 ee e5 ff ff       	call   80100191 <bread>
80101ba3:	89 45 f0             	mov    %eax,-0x10(%ebp)
    a = (uint*)bp->data;
80101ba6:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101ba9:	83 c0 18             	add    $0x18,%eax
80101bac:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if((addr = a[bn]) == 0){
80101baf:	8b 45 0c             	mov    0xc(%ebp),%eax
80101bb2:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101bb9:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101bbc:	01 d0                	add    %edx,%eax
80101bbe:	8b 00                	mov    (%eax),%eax
80101bc0:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101bc3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101bc7:	75 30                	jne    80101bf9 <bmap+0xeb>
      a[bn] = addr = balloc(ip->dev);
80101bc9:	8b 45 0c             	mov    0xc(%ebp),%eax
80101bcc:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101bd3:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101bd6:	8d 1c 02             	lea    (%edx,%eax,1),%ebx
80101bd9:	8b 45 08             	mov    0x8(%ebp),%eax
80101bdc:	8b 00                	mov    (%eax),%eax
80101bde:	89 04 24             	mov    %eax,(%esp)
80101be1:	e8 b1 f7 ff ff       	call   80101397 <balloc>
80101be6:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101be9:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101bec:	89 03                	mov    %eax,(%ebx)
      log_write(bp);
80101bee:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101bf1:	89 04 24             	mov    %eax,(%esp)
80101bf4:	e8 34 17 00 00       	call   8010332d <log_write>
    }
    brelse(bp);
80101bf9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101bfc:	89 04 24             	mov    %eax,(%esp)
80101bff:	e8 fe e5 ff ff       	call   80100202 <brelse>
    return addr;
80101c04:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101c07:	eb 0c                	jmp    80101c15 <bmap+0x107>
  }

  panic("bmap: out of range");
80101c09:	c7 04 24 3a 94 10 80 	movl   $0x8010943a,(%esp)
80101c10:	e8 1d e9 ff ff       	call   80100532 <panic>
}
80101c15:	83 c4 24             	add    $0x24,%esp
80101c18:	5b                   	pop    %ebx
80101c19:	5d                   	pop    %ebp
80101c1a:	c3                   	ret    

80101c1b <itrunc>:
// to it (no directory entries referring to it)
// and has no in-memory reference to it (is
// not an open file or current directory).
void
itrunc(struct inode *ip)
{
80101c1b:	55                   	push   %ebp
80101c1c:	89 e5                	mov    %esp,%ebp
80101c1e:	83 ec 28             	sub    $0x28,%esp
  int i, j;
  struct buf *bp;
  uint *a;

  for(i = 0; i < NDIRECT; i++){
80101c21:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101c28:	eb 44                	jmp    80101c6e <itrunc+0x53>
    if(ip->addrs[i]){
80101c2a:	8b 45 08             	mov    0x8(%ebp),%eax
80101c2d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101c30:	83 c2 04             	add    $0x4,%edx
80101c33:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80101c37:	85 c0                	test   %eax,%eax
80101c39:	74 2f                	je     80101c6a <itrunc+0x4f>
      bfree(ip->dev, ip->addrs[i]);
80101c3b:	8b 45 08             	mov    0x8(%ebp),%eax
80101c3e:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101c41:	83 c2 04             	add    $0x4,%edx
80101c44:	8b 54 90 0c          	mov    0xc(%eax,%edx,4),%edx
80101c48:	8b 45 08             	mov    0x8(%ebp),%eax
80101c4b:	8b 00                	mov    (%eax),%eax
80101c4d:	89 54 24 04          	mov    %edx,0x4(%esp)
80101c51:	89 04 24             	mov    %eax,(%esp)
80101c54:	e8 97 f8 ff ff       	call   801014f0 <bfree>
      ip->addrs[i] = 0;
80101c59:	8b 45 08             	mov    0x8(%ebp),%eax
80101c5c:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101c5f:	83 c2 04             	add    $0x4,%edx
80101c62:	c7 44 90 0c 00 00 00 	movl   $0x0,0xc(%eax,%edx,4)
80101c69:	00 
{
  int i, j;
  struct buf *bp;
  uint *a;

  for(i = 0; i < NDIRECT; i++){
80101c6a:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80101c6e:	83 7d f4 0b          	cmpl   $0xb,-0xc(%ebp)
80101c72:	7e b6                	jle    80101c2a <itrunc+0xf>
      bfree(ip->dev, ip->addrs[i]);
      ip->addrs[i] = 0;
    }
  }
  
  if(ip->addrs[NDIRECT]){
80101c74:	8b 45 08             	mov    0x8(%ebp),%eax
80101c77:	8b 40 4c             	mov    0x4c(%eax),%eax
80101c7a:	85 c0                	test   %eax,%eax
80101c7c:	0f 84 9b 00 00 00    	je     80101d1d <itrunc+0x102>
    bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101c82:	8b 45 08             	mov    0x8(%ebp),%eax
80101c85:	8b 50 4c             	mov    0x4c(%eax),%edx
80101c88:	8b 45 08             	mov    0x8(%ebp),%eax
80101c8b:	8b 00                	mov    (%eax),%eax
80101c8d:	89 54 24 04          	mov    %edx,0x4(%esp)
80101c91:	89 04 24             	mov    %eax,(%esp)
80101c94:	e8 f8 e4 ff ff       	call   80100191 <bread>
80101c99:	89 45 ec             	mov    %eax,-0x14(%ebp)
    a = (uint*)bp->data;
80101c9c:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101c9f:	83 c0 18             	add    $0x18,%eax
80101ca2:	89 45 e8             	mov    %eax,-0x18(%ebp)
    for(j = 0; j < NINDIRECT; j++){
80101ca5:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
80101cac:	eb 3b                	jmp    80101ce9 <itrunc+0xce>
      if(a[j])
80101cae:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101cb1:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101cb8:	8b 45 e8             	mov    -0x18(%ebp),%eax
80101cbb:	01 d0                	add    %edx,%eax
80101cbd:	8b 00                	mov    (%eax),%eax
80101cbf:	85 c0                	test   %eax,%eax
80101cc1:	74 22                	je     80101ce5 <itrunc+0xca>
        bfree(ip->dev, a[j]);
80101cc3:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101cc6:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101ccd:	8b 45 e8             	mov    -0x18(%ebp),%eax
80101cd0:	01 d0                	add    %edx,%eax
80101cd2:	8b 10                	mov    (%eax),%edx
80101cd4:	8b 45 08             	mov    0x8(%ebp),%eax
80101cd7:	8b 00                	mov    (%eax),%eax
80101cd9:	89 54 24 04          	mov    %edx,0x4(%esp)
80101cdd:	89 04 24             	mov    %eax,(%esp)
80101ce0:	e8 0b f8 ff ff       	call   801014f0 <bfree>
  }
  
  if(ip->addrs[NDIRECT]){
    bp = bread(ip->dev, ip->addrs[NDIRECT]);
    a = (uint*)bp->data;
    for(j = 0; j < NINDIRECT; j++){
80101ce5:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
80101ce9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101cec:	83 f8 7f             	cmp    $0x7f,%eax
80101cef:	76 bd                	jbe    80101cae <itrunc+0x93>
      if(a[j])
        bfree(ip->dev, a[j]);
    }
    brelse(bp);
80101cf1:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101cf4:	89 04 24             	mov    %eax,(%esp)
80101cf7:	e8 06 e5 ff ff       	call   80100202 <brelse>
    bfree(ip->dev, ip->addrs[NDIRECT]);
80101cfc:	8b 45 08             	mov    0x8(%ebp),%eax
80101cff:	8b 50 4c             	mov    0x4c(%eax),%edx
80101d02:	8b 45 08             	mov    0x8(%ebp),%eax
80101d05:	8b 00                	mov    (%eax),%eax
80101d07:	89 54 24 04          	mov    %edx,0x4(%esp)
80101d0b:	89 04 24             	mov    %eax,(%esp)
80101d0e:	e8 dd f7 ff ff       	call   801014f0 <bfree>
    ip->addrs[NDIRECT] = 0;
80101d13:	8b 45 08             	mov    0x8(%ebp),%eax
80101d16:	c7 40 4c 00 00 00 00 	movl   $0x0,0x4c(%eax)
  }

  ip->size = 0;
80101d1d:	8b 45 08             	mov    0x8(%ebp),%eax
80101d20:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
  iupdate(ip);
80101d27:	8b 45 08             	mov    0x8(%ebp),%eax
80101d2a:	89 04 24             	mov    %eax,(%esp)
80101d2d:	e8 92 f9 ff ff       	call   801016c4 <iupdate>
}
80101d32:	c9                   	leave  
80101d33:	c3                   	ret    

80101d34 <stati>:

// Copy stat information from inode.
void
stati(struct inode *ip, struct stat *st)
{
80101d34:	55                   	push   %ebp
80101d35:	89 e5                	mov    %esp,%ebp
  st->dev = ip->dev;
80101d37:	8b 45 08             	mov    0x8(%ebp),%eax
80101d3a:	8b 00                	mov    (%eax),%eax
80101d3c:	89 c2                	mov    %eax,%edx
80101d3e:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d41:	89 50 04             	mov    %edx,0x4(%eax)
  st->ino = ip->inum;
80101d44:	8b 45 08             	mov    0x8(%ebp),%eax
80101d47:	8b 50 04             	mov    0x4(%eax),%edx
80101d4a:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d4d:	89 50 08             	mov    %edx,0x8(%eax)
  st->type = ip->type;
80101d50:	8b 45 08             	mov    0x8(%ebp),%eax
80101d53:	0f b7 50 10          	movzwl 0x10(%eax),%edx
80101d57:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d5a:	66 89 10             	mov    %dx,(%eax)
  st->nlink = ip->nlink;
80101d5d:	8b 45 08             	mov    0x8(%ebp),%eax
80101d60:	0f b7 50 16          	movzwl 0x16(%eax),%edx
80101d64:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d67:	66 89 50 0c          	mov    %dx,0xc(%eax)
  st->size = ip->size;
80101d6b:	8b 45 08             	mov    0x8(%ebp),%eax
80101d6e:	8b 50 18             	mov    0x18(%eax),%edx
80101d71:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d74:	89 50 10             	mov    %edx,0x10(%eax)
}
80101d77:	5d                   	pop    %ebp
80101d78:	c3                   	ret    

80101d79 <readi>:

//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101d79:	55                   	push   %ebp
80101d7a:	89 e5                	mov    %esp,%ebp
80101d7c:	53                   	push   %ebx
80101d7d:	83 ec 24             	sub    $0x24,%esp
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
80101d80:	8b 45 08             	mov    0x8(%ebp),%eax
80101d83:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80101d87:	66 83 f8 03          	cmp    $0x3,%ax
80101d8b:	75 60                	jne    80101ded <readi+0x74>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101d8d:	8b 45 08             	mov    0x8(%ebp),%eax
80101d90:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101d94:	66 85 c0             	test   %ax,%ax
80101d97:	78 20                	js     80101db9 <readi+0x40>
80101d99:	8b 45 08             	mov    0x8(%ebp),%eax
80101d9c:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101da0:	66 83 f8 09          	cmp    $0x9,%ax
80101da4:	7f 13                	jg     80101db9 <readi+0x40>
80101da6:	8b 45 08             	mov    0x8(%ebp),%eax
80101da9:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101dad:	98                   	cwtl   
80101dae:	8b 04 c5 60 f8 10 80 	mov    -0x7fef07a0(,%eax,8),%eax
80101db5:	85 c0                	test   %eax,%eax
80101db7:	75 0a                	jne    80101dc3 <readi+0x4a>
      return -1;
80101db9:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101dbe:	e9 1e 01 00 00       	jmp    80101ee1 <readi+0x168>
    return devsw[ip->major].read(ip, dst, n);
80101dc3:	8b 45 08             	mov    0x8(%ebp),%eax
80101dc6:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101dca:	98                   	cwtl   
80101dcb:	8b 04 c5 60 f8 10 80 	mov    -0x7fef07a0(,%eax,8),%eax
80101dd2:	8b 55 14             	mov    0x14(%ebp),%edx
80101dd5:	89 54 24 08          	mov    %edx,0x8(%esp)
80101dd9:	8b 55 0c             	mov    0xc(%ebp),%edx
80101ddc:	89 54 24 04          	mov    %edx,0x4(%esp)
80101de0:	8b 55 08             	mov    0x8(%ebp),%edx
80101de3:	89 14 24             	mov    %edx,(%esp)
80101de6:	ff d0                	call   *%eax
80101de8:	e9 f4 00 00 00       	jmp    80101ee1 <readi+0x168>
  }

  if(off > ip->size || off + n < off)
80101ded:	8b 45 08             	mov    0x8(%ebp),%eax
80101df0:	8b 40 18             	mov    0x18(%eax),%eax
80101df3:	3b 45 10             	cmp    0x10(%ebp),%eax
80101df6:	72 0d                	jb     80101e05 <readi+0x8c>
80101df8:	8b 45 14             	mov    0x14(%ebp),%eax
80101dfb:	8b 55 10             	mov    0x10(%ebp),%edx
80101dfe:	01 d0                	add    %edx,%eax
80101e00:	3b 45 10             	cmp    0x10(%ebp),%eax
80101e03:	73 0a                	jae    80101e0f <readi+0x96>
    return -1;
80101e05:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101e0a:	e9 d2 00 00 00       	jmp    80101ee1 <readi+0x168>
  if(off + n > ip->size)
80101e0f:	8b 45 14             	mov    0x14(%ebp),%eax
80101e12:	8b 55 10             	mov    0x10(%ebp),%edx
80101e15:	01 c2                	add    %eax,%edx
80101e17:	8b 45 08             	mov    0x8(%ebp),%eax
80101e1a:	8b 40 18             	mov    0x18(%eax),%eax
80101e1d:	39 c2                	cmp    %eax,%edx
80101e1f:	76 0c                	jbe    80101e2d <readi+0xb4>
    n = ip->size - off;
80101e21:	8b 45 08             	mov    0x8(%ebp),%eax
80101e24:	8b 40 18             	mov    0x18(%eax),%eax
80101e27:	2b 45 10             	sub    0x10(%ebp),%eax
80101e2a:	89 45 14             	mov    %eax,0x14(%ebp)

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101e2d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101e34:	e9 99 00 00 00       	jmp    80101ed2 <readi+0x159>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101e39:	8b 45 10             	mov    0x10(%ebp),%eax
80101e3c:	c1 e8 09             	shr    $0x9,%eax
80101e3f:	89 44 24 04          	mov    %eax,0x4(%esp)
80101e43:	8b 45 08             	mov    0x8(%ebp),%eax
80101e46:	89 04 24             	mov    %eax,(%esp)
80101e49:	e8 c0 fc ff ff       	call   80101b0e <bmap>
80101e4e:	8b 55 08             	mov    0x8(%ebp),%edx
80101e51:	8b 12                	mov    (%edx),%edx
80101e53:	89 44 24 04          	mov    %eax,0x4(%esp)
80101e57:	89 14 24             	mov    %edx,(%esp)
80101e5a:	e8 32 e3 ff ff       	call   80100191 <bread>
80101e5f:	89 45 f0             	mov    %eax,-0x10(%ebp)
    m = min(n - tot, BSIZE - off%BSIZE);
80101e62:	8b 45 10             	mov    0x10(%ebp),%eax
80101e65:	89 c2                	mov    %eax,%edx
80101e67:	81 e2 ff 01 00 00    	and    $0x1ff,%edx
80101e6d:	b8 00 02 00 00       	mov    $0x200,%eax
80101e72:	89 c1                	mov    %eax,%ecx
80101e74:	29 d1                	sub    %edx,%ecx
80101e76:	89 ca                	mov    %ecx,%edx
80101e78:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101e7b:	8b 4d 14             	mov    0x14(%ebp),%ecx
80101e7e:	89 cb                	mov    %ecx,%ebx
80101e80:	29 c3                	sub    %eax,%ebx
80101e82:	89 d8                	mov    %ebx,%eax
80101e84:	39 c2                	cmp    %eax,%edx
80101e86:	0f 46 c2             	cmovbe %edx,%eax
80101e89:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(dst, bp->data + off%BSIZE, m);
80101e8c:	8b 45 10             	mov    0x10(%ebp),%eax
80101e8f:	25 ff 01 00 00       	and    $0x1ff,%eax
80101e94:	8d 50 10             	lea    0x10(%eax),%edx
80101e97:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101e9a:	01 d0                	add    %edx,%eax
80101e9c:	8d 50 08             	lea    0x8(%eax),%edx
80101e9f:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ea2:	89 44 24 08          	mov    %eax,0x8(%esp)
80101ea6:	89 54 24 04          	mov    %edx,0x4(%esp)
80101eaa:	8b 45 0c             	mov    0xc(%ebp),%eax
80101ead:	89 04 24             	mov    %eax,(%esp)
80101eb0:	e8 80 40 00 00       	call   80105f35 <memmove>
    brelse(bp);
80101eb5:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101eb8:	89 04 24             	mov    %eax,(%esp)
80101ebb:	e8 42 e3 ff ff       	call   80100202 <brelse>
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > ip->size)
    n = ip->size - off;

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101ec0:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ec3:	01 45 f4             	add    %eax,-0xc(%ebp)
80101ec6:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ec9:	01 45 10             	add    %eax,0x10(%ebp)
80101ecc:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ecf:	01 45 0c             	add    %eax,0xc(%ebp)
80101ed2:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101ed5:	3b 45 14             	cmp    0x14(%ebp),%eax
80101ed8:	0f 82 5b ff ff ff    	jb     80101e39 <readi+0xc0>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
    m = min(n - tot, BSIZE - off%BSIZE);
    memmove(dst, bp->data + off%BSIZE, m);
    brelse(bp);
  }
  return n;
80101ede:	8b 45 14             	mov    0x14(%ebp),%eax
}
80101ee1:	83 c4 24             	add    $0x24,%esp
80101ee4:	5b                   	pop    %ebx
80101ee5:	5d                   	pop    %ebp
80101ee6:	c3                   	ret    

80101ee7 <writei>:

// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101ee7:	55                   	push   %ebp
80101ee8:	89 e5                	mov    %esp,%ebp
80101eea:	53                   	push   %ebx
80101eeb:	83 ec 24             	sub    $0x24,%esp
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
80101eee:	8b 45 08             	mov    0x8(%ebp),%eax
80101ef1:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80101ef5:	66 83 f8 03          	cmp    $0x3,%ax
80101ef9:	75 60                	jne    80101f5b <writei+0x74>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80101efb:	8b 45 08             	mov    0x8(%ebp),%eax
80101efe:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f02:	66 85 c0             	test   %ax,%ax
80101f05:	78 20                	js     80101f27 <writei+0x40>
80101f07:	8b 45 08             	mov    0x8(%ebp),%eax
80101f0a:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f0e:	66 83 f8 09          	cmp    $0x9,%ax
80101f12:	7f 13                	jg     80101f27 <writei+0x40>
80101f14:	8b 45 08             	mov    0x8(%ebp),%eax
80101f17:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f1b:	98                   	cwtl   
80101f1c:	8b 04 c5 64 f8 10 80 	mov    -0x7fef079c(,%eax,8),%eax
80101f23:	85 c0                	test   %eax,%eax
80101f25:	75 0a                	jne    80101f31 <writei+0x4a>
      return -1;
80101f27:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101f2c:	e9 49 01 00 00       	jmp    8010207a <writei+0x193>
    return devsw[ip->major].write(ip, src, n);
80101f31:	8b 45 08             	mov    0x8(%ebp),%eax
80101f34:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f38:	98                   	cwtl   
80101f39:	8b 04 c5 64 f8 10 80 	mov    -0x7fef079c(,%eax,8),%eax
80101f40:	8b 55 14             	mov    0x14(%ebp),%edx
80101f43:	89 54 24 08          	mov    %edx,0x8(%esp)
80101f47:	8b 55 0c             	mov    0xc(%ebp),%edx
80101f4a:	89 54 24 04          	mov    %edx,0x4(%esp)
80101f4e:	8b 55 08             	mov    0x8(%ebp),%edx
80101f51:	89 14 24             	mov    %edx,(%esp)
80101f54:	ff d0                	call   *%eax
80101f56:	e9 1f 01 00 00       	jmp    8010207a <writei+0x193>
  }

  if(off > ip->size || off + n < off)
80101f5b:	8b 45 08             	mov    0x8(%ebp),%eax
80101f5e:	8b 40 18             	mov    0x18(%eax),%eax
80101f61:	3b 45 10             	cmp    0x10(%ebp),%eax
80101f64:	72 0d                	jb     80101f73 <writei+0x8c>
80101f66:	8b 45 14             	mov    0x14(%ebp),%eax
80101f69:	8b 55 10             	mov    0x10(%ebp),%edx
80101f6c:	01 d0                	add    %edx,%eax
80101f6e:	3b 45 10             	cmp    0x10(%ebp),%eax
80101f71:	73 0a                	jae    80101f7d <writei+0x96>
    return -1;
80101f73:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101f78:	e9 fd 00 00 00       	jmp    8010207a <writei+0x193>
  if(off + n > MAXFILE*BSIZE)
80101f7d:	8b 45 14             	mov    0x14(%ebp),%eax
80101f80:	8b 55 10             	mov    0x10(%ebp),%edx
80101f83:	01 d0                	add    %edx,%eax
80101f85:	3d 00 18 01 00       	cmp    $0x11800,%eax
80101f8a:	76 0a                	jbe    80101f96 <writei+0xaf>
    return -1;
80101f8c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101f91:	e9 e4 00 00 00       	jmp    8010207a <writei+0x193>

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101f96:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101f9d:	e9 a4 00 00 00       	jmp    80102046 <writei+0x15f>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101fa2:	8b 45 10             	mov    0x10(%ebp),%eax
80101fa5:	c1 e8 09             	shr    $0x9,%eax
80101fa8:	89 44 24 04          	mov    %eax,0x4(%esp)
80101fac:	8b 45 08             	mov    0x8(%ebp),%eax
80101faf:	89 04 24             	mov    %eax,(%esp)
80101fb2:	e8 57 fb ff ff       	call   80101b0e <bmap>
80101fb7:	8b 55 08             	mov    0x8(%ebp),%edx
80101fba:	8b 12                	mov    (%edx),%edx
80101fbc:	89 44 24 04          	mov    %eax,0x4(%esp)
80101fc0:	89 14 24             	mov    %edx,(%esp)
80101fc3:	e8 c9 e1 ff ff       	call   80100191 <bread>
80101fc8:	89 45 f0             	mov    %eax,-0x10(%ebp)
    m = min(n - tot, BSIZE - off%BSIZE);
80101fcb:	8b 45 10             	mov    0x10(%ebp),%eax
80101fce:	89 c2                	mov    %eax,%edx
80101fd0:	81 e2 ff 01 00 00    	and    $0x1ff,%edx
80101fd6:	b8 00 02 00 00       	mov    $0x200,%eax
80101fdb:	89 c1                	mov    %eax,%ecx
80101fdd:	29 d1                	sub    %edx,%ecx
80101fdf:	89 ca                	mov    %ecx,%edx
80101fe1:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101fe4:	8b 4d 14             	mov    0x14(%ebp),%ecx
80101fe7:	89 cb                	mov    %ecx,%ebx
80101fe9:	29 c3                	sub    %eax,%ebx
80101feb:	89 d8                	mov    %ebx,%eax
80101fed:	39 c2                	cmp    %eax,%edx
80101fef:	0f 46 c2             	cmovbe %edx,%eax
80101ff2:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(bp->data + off%BSIZE, src, m);
80101ff5:	8b 45 10             	mov    0x10(%ebp),%eax
80101ff8:	25 ff 01 00 00       	and    $0x1ff,%eax
80101ffd:	8d 50 10             	lea    0x10(%eax),%edx
80102000:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102003:	01 d0                	add    %edx,%eax
80102005:	8d 50 08             	lea    0x8(%eax),%edx
80102008:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010200b:	89 44 24 08          	mov    %eax,0x8(%esp)
8010200f:	8b 45 0c             	mov    0xc(%ebp),%eax
80102012:	89 44 24 04          	mov    %eax,0x4(%esp)
80102016:	89 14 24             	mov    %edx,(%esp)
80102019:	e8 17 3f 00 00       	call   80105f35 <memmove>
    log_write(bp);
8010201e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102021:	89 04 24             	mov    %eax,(%esp)
80102024:	e8 04 13 00 00       	call   8010332d <log_write>
    brelse(bp);
80102029:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010202c:	89 04 24             	mov    %eax,(%esp)
8010202f:	e8 ce e1 ff ff       	call   80100202 <brelse>
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > MAXFILE*BSIZE)
    return -1;

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80102034:	8b 45 ec             	mov    -0x14(%ebp),%eax
80102037:	01 45 f4             	add    %eax,-0xc(%ebp)
8010203a:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010203d:	01 45 10             	add    %eax,0x10(%ebp)
80102040:	8b 45 ec             	mov    -0x14(%ebp),%eax
80102043:	01 45 0c             	add    %eax,0xc(%ebp)
80102046:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102049:	3b 45 14             	cmp    0x14(%ebp),%eax
8010204c:	0f 82 50 ff ff ff    	jb     80101fa2 <writei+0xbb>
    memmove(bp->data + off%BSIZE, src, m);
    log_write(bp);
    brelse(bp);
  }

  if(n > 0 && off > ip->size){
80102052:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
80102056:	74 1f                	je     80102077 <writei+0x190>
80102058:	8b 45 08             	mov    0x8(%ebp),%eax
8010205b:	8b 40 18             	mov    0x18(%eax),%eax
8010205e:	3b 45 10             	cmp    0x10(%ebp),%eax
80102061:	73 14                	jae    80102077 <writei+0x190>
    ip->size = off;
80102063:	8b 45 08             	mov    0x8(%ebp),%eax
80102066:	8b 55 10             	mov    0x10(%ebp),%edx
80102069:	89 50 18             	mov    %edx,0x18(%eax)
    iupdate(ip);
8010206c:	8b 45 08             	mov    0x8(%ebp),%eax
8010206f:	89 04 24             	mov    %eax,(%esp)
80102072:	e8 4d f6 ff ff       	call   801016c4 <iupdate>
  }
  return n;
80102077:	8b 45 14             	mov    0x14(%ebp),%eax
}
8010207a:	83 c4 24             	add    $0x24,%esp
8010207d:	5b                   	pop    %ebx
8010207e:	5d                   	pop    %ebp
8010207f:	c3                   	ret    

80102080 <namecmp>:
//PAGEBREAK!
// Directories

int
namecmp(const char *s, const char *t)
{
80102080:	55                   	push   %ebp
80102081:	89 e5                	mov    %esp,%ebp
80102083:	83 ec 18             	sub    $0x18,%esp
  return strncmp(s, t, DIRSIZ);
80102086:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
8010208d:	00 
8010208e:	8b 45 0c             	mov    0xc(%ebp),%eax
80102091:	89 44 24 04          	mov    %eax,0x4(%esp)
80102095:	8b 45 08             	mov    0x8(%ebp),%eax
80102098:	89 04 24             	mov    %eax,(%esp)
8010209b:	e8 39 3f 00 00       	call   80105fd9 <strncmp>
}
801020a0:	c9                   	leave  
801020a1:	c3                   	ret    

801020a2 <dirlookup>:

// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
801020a2:	55                   	push   %ebp
801020a3:	89 e5                	mov    %esp,%ebp
801020a5:	83 ec 38             	sub    $0x38,%esp
  uint off, inum;
  struct dirent de;

  if(dp->type != T_DIR)
801020a8:	8b 45 08             	mov    0x8(%ebp),%eax
801020ab:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801020af:	66 83 f8 01          	cmp    $0x1,%ax
801020b3:	74 0c                	je     801020c1 <dirlookup+0x1f>
    panic("dirlookup not DIR");
801020b5:	c7 04 24 4d 94 10 80 	movl   $0x8010944d,(%esp)
801020bc:	e8 71 e4 ff ff       	call   80100532 <panic>

  for(off = 0; off < dp->size; off += sizeof(de)){
801020c1:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801020c8:	e9 87 00 00 00       	jmp    80102154 <dirlookup+0xb2>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801020cd:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
801020d4:	00 
801020d5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801020d8:	89 44 24 08          	mov    %eax,0x8(%esp)
801020dc:	8d 45 e0             	lea    -0x20(%ebp),%eax
801020df:	89 44 24 04          	mov    %eax,0x4(%esp)
801020e3:	8b 45 08             	mov    0x8(%ebp),%eax
801020e6:	89 04 24             	mov    %eax,(%esp)
801020e9:	e8 8b fc ff ff       	call   80101d79 <readi>
801020ee:	83 f8 10             	cmp    $0x10,%eax
801020f1:	74 0c                	je     801020ff <dirlookup+0x5d>
      panic("dirlink read");
801020f3:	c7 04 24 5f 94 10 80 	movl   $0x8010945f,(%esp)
801020fa:	e8 33 e4 ff ff       	call   80100532 <panic>
    if(de.inum == 0)
801020ff:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
80102103:	66 85 c0             	test   %ax,%ax
80102106:	74 47                	je     8010214f <dirlookup+0xad>
      continue;
    if(namecmp(name, de.name) == 0){
80102108:	8d 45 e0             	lea    -0x20(%ebp),%eax
8010210b:	83 c0 02             	add    $0x2,%eax
8010210e:	89 44 24 04          	mov    %eax,0x4(%esp)
80102112:	8b 45 0c             	mov    0xc(%ebp),%eax
80102115:	89 04 24             	mov    %eax,(%esp)
80102118:	e8 63 ff ff ff       	call   80102080 <namecmp>
8010211d:	85 c0                	test   %eax,%eax
8010211f:	75 2f                	jne    80102150 <dirlookup+0xae>
      // entry matches path element
      if(poff)
80102121:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80102125:	74 08                	je     8010212f <dirlookup+0x8d>
        *poff = off;
80102127:	8b 45 10             	mov    0x10(%ebp),%eax
8010212a:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010212d:	89 10                	mov    %edx,(%eax)
      inum = de.inum;
8010212f:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
80102133:	0f b7 c0             	movzwl %ax,%eax
80102136:	89 45 f0             	mov    %eax,-0x10(%ebp)
      return iget(dp->dev, inum);
80102139:	8b 45 08             	mov    0x8(%ebp),%eax
8010213c:	8b 00                	mov    (%eax),%eax
8010213e:	8b 55 f0             	mov    -0x10(%ebp),%edx
80102141:	89 54 24 04          	mov    %edx,0x4(%esp)
80102145:	89 04 24             	mov    %eax,(%esp)
80102148:	e8 2f f6 ff ff       	call   8010177c <iget>
8010214d:	eb 19                	jmp    80102168 <dirlookup+0xc6>

  for(off = 0; off < dp->size; off += sizeof(de)){
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("dirlink read");
    if(de.inum == 0)
      continue;
8010214f:	90                   	nop
  struct dirent de;

  if(dp->type != T_DIR)
    panic("dirlookup not DIR");

  for(off = 0; off < dp->size; off += sizeof(de)){
80102150:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
80102154:	8b 45 08             	mov    0x8(%ebp),%eax
80102157:	8b 40 18             	mov    0x18(%eax),%eax
8010215a:	3b 45 f4             	cmp    -0xc(%ebp),%eax
8010215d:	0f 87 6a ff ff ff    	ja     801020cd <dirlookup+0x2b>
      inum = de.inum;
      return iget(dp->dev, inum);
    }
  }

  return 0;
80102163:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102168:	c9                   	leave  
80102169:	c3                   	ret    

8010216a <dirlink>:

// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
8010216a:	55                   	push   %ebp
8010216b:	89 e5                	mov    %esp,%ebp
8010216d:	83 ec 38             	sub    $0x38,%esp
  int off;
  struct dirent de;
  struct inode *ip;

  // Check that name is not present.
  if((ip = dirlookup(dp, name, 0)) != 0){
80102170:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80102177:	00 
80102178:	8b 45 0c             	mov    0xc(%ebp),%eax
8010217b:	89 44 24 04          	mov    %eax,0x4(%esp)
8010217f:	8b 45 08             	mov    0x8(%ebp),%eax
80102182:	89 04 24             	mov    %eax,(%esp)
80102185:	e8 18 ff ff ff       	call   801020a2 <dirlookup>
8010218a:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010218d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80102191:	74 15                	je     801021a8 <dirlink+0x3e>
    iput(ip);
80102193:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102196:	89 04 24             	mov    %eax,(%esp)
80102199:	e8 81 f8 ff ff       	call   80101a1f <iput>
    return -1;
8010219e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801021a3:	e9 b8 00 00 00       	jmp    80102260 <dirlink+0xf6>
  }

  // Look for an empty dirent.
  for(off = 0; off < dp->size; off += sizeof(de)){
801021a8:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801021af:	eb 44                	jmp    801021f5 <dirlink+0x8b>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801021b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801021b4:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
801021bb:	00 
801021bc:	89 44 24 08          	mov    %eax,0x8(%esp)
801021c0:	8d 45 e0             	lea    -0x20(%ebp),%eax
801021c3:	89 44 24 04          	mov    %eax,0x4(%esp)
801021c7:	8b 45 08             	mov    0x8(%ebp),%eax
801021ca:	89 04 24             	mov    %eax,(%esp)
801021cd:	e8 a7 fb ff ff       	call   80101d79 <readi>
801021d2:	83 f8 10             	cmp    $0x10,%eax
801021d5:	74 0c                	je     801021e3 <dirlink+0x79>
      panic("dirlink read");
801021d7:	c7 04 24 5f 94 10 80 	movl   $0x8010945f,(%esp)
801021de:	e8 4f e3 ff ff       	call   80100532 <panic>
    if(de.inum == 0)
801021e3:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
801021e7:	66 85 c0             	test   %ax,%ax
801021ea:	74 18                	je     80102204 <dirlink+0x9a>
    iput(ip);
    return -1;
  }

  // Look for an empty dirent.
  for(off = 0; off < dp->size; off += sizeof(de)){
801021ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
801021ef:	83 c0 10             	add    $0x10,%eax
801021f2:	89 45 f4             	mov    %eax,-0xc(%ebp)
801021f5:	8b 55 f4             	mov    -0xc(%ebp),%edx
801021f8:	8b 45 08             	mov    0x8(%ebp),%eax
801021fb:	8b 40 18             	mov    0x18(%eax),%eax
801021fe:	39 c2                	cmp    %eax,%edx
80102200:	72 af                	jb     801021b1 <dirlink+0x47>
80102202:	eb 01                	jmp    80102205 <dirlink+0x9b>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("dirlink read");
    if(de.inum == 0)
      break;
80102204:	90                   	nop
  }

  strncpy(de.name, name, DIRSIZ);
80102205:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
8010220c:	00 
8010220d:	8b 45 0c             	mov    0xc(%ebp),%eax
80102210:	89 44 24 04          	mov    %eax,0x4(%esp)
80102214:	8d 45 e0             	lea    -0x20(%ebp),%eax
80102217:	83 c0 02             	add    $0x2,%eax
8010221a:	89 04 24             	mov    %eax,(%esp)
8010221d:	e8 0f 3e 00 00       	call   80106031 <strncpy>
  de.inum = inum;
80102222:	8b 45 10             	mov    0x10(%ebp),%eax
80102225:	66 89 45 e0          	mov    %ax,-0x20(%ebp)
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80102229:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010222c:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
80102233:	00 
80102234:	89 44 24 08          	mov    %eax,0x8(%esp)
80102238:	8d 45 e0             	lea    -0x20(%ebp),%eax
8010223b:	89 44 24 04          	mov    %eax,0x4(%esp)
8010223f:	8b 45 08             	mov    0x8(%ebp),%eax
80102242:	89 04 24             	mov    %eax,(%esp)
80102245:	e8 9d fc ff ff       	call   80101ee7 <writei>
8010224a:	83 f8 10             	cmp    $0x10,%eax
8010224d:	74 0c                	je     8010225b <dirlink+0xf1>
    panic("dirlink");
8010224f:	c7 04 24 6c 94 10 80 	movl   $0x8010946c,(%esp)
80102256:	e8 d7 e2 ff ff       	call   80100532 <panic>
  
  return 0;
8010225b:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102260:	c9                   	leave  
80102261:	c3                   	ret    

80102262 <skipelem>:
//   skipelem("a", name) = "", setting name = "a"
//   skipelem("", name) = skipelem("////", name) = 0
//
static char*
skipelem(char *path, char *name)
{
80102262:	55                   	push   %ebp
80102263:	89 e5                	mov    %esp,%ebp
80102265:	83 ec 28             	sub    $0x28,%esp
  char *s;
  int len;

  while(*path == '/')
80102268:	eb 04                	jmp    8010226e <skipelem+0xc>
    path++;
8010226a:	83 45 08 01          	addl   $0x1,0x8(%ebp)
skipelem(char *path, char *name)
{
  char *s;
  int len;

  while(*path == '/')
8010226e:	8b 45 08             	mov    0x8(%ebp),%eax
80102271:	0f b6 00             	movzbl (%eax),%eax
80102274:	3c 2f                	cmp    $0x2f,%al
80102276:	74 f2                	je     8010226a <skipelem+0x8>
    path++;
  if(*path == 0)
80102278:	8b 45 08             	mov    0x8(%ebp),%eax
8010227b:	0f b6 00             	movzbl (%eax),%eax
8010227e:	84 c0                	test   %al,%al
80102280:	75 0a                	jne    8010228c <skipelem+0x2a>
    return 0;
80102282:	b8 00 00 00 00       	mov    $0x0,%eax
80102287:	e9 88 00 00 00       	jmp    80102314 <skipelem+0xb2>
  s = path;
8010228c:	8b 45 08             	mov    0x8(%ebp),%eax
8010228f:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(*path != '/' && *path != 0)
80102292:	eb 04                	jmp    80102298 <skipelem+0x36>
    path++;
80102294:	83 45 08 01          	addl   $0x1,0x8(%ebp)
  while(*path == '/')
    path++;
  if(*path == 0)
    return 0;
  s = path;
  while(*path != '/' && *path != 0)
80102298:	8b 45 08             	mov    0x8(%ebp),%eax
8010229b:	0f b6 00             	movzbl (%eax),%eax
8010229e:	3c 2f                	cmp    $0x2f,%al
801022a0:	74 0a                	je     801022ac <skipelem+0x4a>
801022a2:	8b 45 08             	mov    0x8(%ebp),%eax
801022a5:	0f b6 00             	movzbl (%eax),%eax
801022a8:	84 c0                	test   %al,%al
801022aa:	75 e8                	jne    80102294 <skipelem+0x32>
    path++;
  len = path - s;
801022ac:	8b 55 08             	mov    0x8(%ebp),%edx
801022af:	8b 45 f4             	mov    -0xc(%ebp),%eax
801022b2:	89 d1                	mov    %edx,%ecx
801022b4:	29 c1                	sub    %eax,%ecx
801022b6:	89 c8                	mov    %ecx,%eax
801022b8:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(len >= DIRSIZ)
801022bb:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
801022bf:	7e 1c                	jle    801022dd <skipelem+0x7b>
    memmove(name, s, DIRSIZ);
801022c1:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
801022c8:	00 
801022c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801022cc:	89 44 24 04          	mov    %eax,0x4(%esp)
801022d0:	8b 45 0c             	mov    0xc(%ebp),%eax
801022d3:	89 04 24             	mov    %eax,(%esp)
801022d6:	e8 5a 3c 00 00       	call   80105f35 <memmove>
  else {
    memmove(name, s, len);
    name[len] = 0;
  }
  while(*path == '/')
801022db:	eb 2a                	jmp    80102307 <skipelem+0xa5>
    path++;
  len = path - s;
  if(len >= DIRSIZ)
    memmove(name, s, DIRSIZ);
  else {
    memmove(name, s, len);
801022dd:	8b 45 f0             	mov    -0x10(%ebp),%eax
801022e0:	89 44 24 08          	mov    %eax,0x8(%esp)
801022e4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801022e7:	89 44 24 04          	mov    %eax,0x4(%esp)
801022eb:	8b 45 0c             	mov    0xc(%ebp),%eax
801022ee:	89 04 24             	mov    %eax,(%esp)
801022f1:	e8 3f 3c 00 00       	call   80105f35 <memmove>
    name[len] = 0;
801022f6:	8b 55 f0             	mov    -0x10(%ebp),%edx
801022f9:	8b 45 0c             	mov    0xc(%ebp),%eax
801022fc:	01 d0                	add    %edx,%eax
801022fe:	c6 00 00             	movb   $0x0,(%eax)
  }
  while(*path == '/')
80102301:	eb 04                	jmp    80102307 <skipelem+0xa5>
    path++;
80102303:	83 45 08 01          	addl   $0x1,0x8(%ebp)
    memmove(name, s, DIRSIZ);
  else {
    memmove(name, s, len);
    name[len] = 0;
  }
  while(*path == '/')
80102307:	8b 45 08             	mov    0x8(%ebp),%eax
8010230a:	0f b6 00             	movzbl (%eax),%eax
8010230d:	3c 2f                	cmp    $0x2f,%al
8010230f:	74 f2                	je     80102303 <skipelem+0xa1>
    path++;
  return path;
80102311:	8b 45 08             	mov    0x8(%ebp),%eax
}
80102314:	c9                   	leave  
80102315:	c3                   	ret    

80102316 <namex>:
// Look up and return the inode for a path name.
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
static struct inode*
namex(char *path, int nameiparent, char *name)
{
80102316:	55                   	push   %ebp
80102317:	89 e5                	mov    %esp,%ebp
80102319:	83 ec 28             	sub    $0x28,%esp
  struct inode *ip, *next;
//   cprintf("namex 1\n");
  if(*path == '/')
8010231c:	8b 45 08             	mov    0x8(%ebp),%eax
8010231f:	0f b6 00             	movzbl (%eax),%eax
80102322:	3c 2f                	cmp    $0x2f,%al
80102324:	75 1c                	jne    80102342 <namex+0x2c>
    ip = iget(ROOTDEV, ROOTINO);
80102326:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
8010232d:	00 
8010232e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80102335:	e8 42 f4 ff ff       	call   8010177c <iget>
8010233a:	89 45 f4             	mov    %eax,-0xc(%ebp)
  else
    ip = idup(proc->cwd);
// cprintf("namex 2\n");
  while((path = skipelem(path, name)) != 0){
8010233d:	e9 af 00 00 00       	jmp    801023f1 <namex+0xdb>
  struct inode *ip, *next;
//   cprintf("namex 1\n");
  if(*path == '/')
    ip = iget(ROOTDEV, ROOTINO);
  else
    ip = idup(proc->cwd);
80102342:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80102348:	8b 40 68             	mov    0x68(%eax),%eax
8010234b:	89 04 24             	mov    %eax,(%esp)
8010234e:	e8 fb f4 ff ff       	call   8010184e <idup>
80102353:	89 45 f4             	mov    %eax,-0xc(%ebp)
// cprintf("namex 2\n");
  while((path = skipelem(path, name)) != 0){
80102356:	e9 96 00 00 00       	jmp    801023f1 <namex+0xdb>
//     cprintf("namex while\n");
    ilock(ip);
8010235b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010235e:	89 04 24             	mov    %eax,(%esp)
80102361:	e8 1a f5 ff ff       	call   80101880 <ilock>
//      cprintf("namex while2\n");
    if(ip->type != T_DIR){
80102366:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102369:	0f b7 40 10          	movzwl 0x10(%eax),%eax
8010236d:	66 83 f8 01          	cmp    $0x1,%ax
80102371:	74 15                	je     80102388 <namex+0x72>
//       cprintf("not good\n");
      iunlockput(ip);
80102373:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102376:	89 04 24             	mov    %eax,(%esp)
80102379:	e8 72 f7 ff ff       	call   80101af0 <iunlockput>
      return 0;
8010237e:	b8 00 00 00 00       	mov    $0x0,%eax
80102383:	e9 a3 00 00 00       	jmp    8010242b <namex+0x115>
    }
    if(nameiparent && *path == '\0'){
80102388:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
8010238c:	74 1d                	je     801023ab <namex+0x95>
8010238e:	8b 45 08             	mov    0x8(%ebp),%eax
80102391:	0f b6 00             	movzbl (%eax),%eax
80102394:	84 c0                	test   %al,%al
80102396:	75 13                	jne    801023ab <namex+0x95>
      // Stop one level early.
//        cprintf("ok? good\n");
      iunlock(ip);
80102398:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010239b:	89 04 24             	mov    %eax,(%esp)
8010239e:	e8 17 f6 ff ff       	call   801019ba <iunlock>
      return ip;
801023a3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023a6:	e9 80 00 00 00       	jmp    8010242b <namex+0x115>
    }
//     cprintf("hoieh\n");
    if((next = dirlookup(ip, name, 0)) == 0){
801023ab:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
801023b2:	00 
801023b3:	8b 45 10             	mov    0x10(%ebp),%eax
801023b6:	89 44 24 04          	mov    %eax,0x4(%esp)
801023ba:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023bd:	89 04 24             	mov    %eax,(%esp)
801023c0:	e8 dd fc ff ff       	call   801020a2 <dirlookup>
801023c5:	89 45 f0             	mov    %eax,-0x10(%ebp)
801023c8:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801023cc:	75 12                	jne    801023e0 <namex+0xca>
//       cprintf("namex if1\n");
      iunlockput(ip);
801023ce:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023d1:	89 04 24             	mov    %eax,(%esp)
801023d4:	e8 17 f7 ff ff       	call   80101af0 <iunlockput>
//       cprintf("namex if2\n");
      return 0;
801023d9:	b8 00 00 00 00       	mov    $0x0,%eax
801023de:	eb 4b                	jmp    8010242b <namex+0x115>
    }
//     cprintf("namex 3\n");
    iunlockput(ip);
801023e0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023e3:	89 04 24             	mov    %eax,(%esp)
801023e6:	e8 05 f7 ff ff       	call   80101af0 <iunlockput>
    ip = next;
801023eb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801023ee:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(*path == '/')
    ip = iget(ROOTDEV, ROOTINO);
  else
    ip = idup(proc->cwd);
// cprintf("namex 2\n");
  while((path = skipelem(path, name)) != 0){
801023f1:	8b 45 10             	mov    0x10(%ebp),%eax
801023f4:	89 44 24 04          	mov    %eax,0x4(%esp)
801023f8:	8b 45 08             	mov    0x8(%ebp),%eax
801023fb:	89 04 24             	mov    %eax,(%esp)
801023fe:	e8 5f fe ff ff       	call   80102262 <skipelem>
80102403:	89 45 08             	mov    %eax,0x8(%ebp)
80102406:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010240a:	0f 85 4b ff ff ff    	jne    8010235b <namex+0x45>
//     cprintf("namex 3\n");
    iunlockput(ip);
    ip = next;
//     cprintf("namex 4\n");
  }
  if(nameiparent){
80102410:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80102414:	74 12                	je     80102428 <namex+0x112>
    iput(ip);
80102416:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102419:	89 04 24             	mov    %eax,(%esp)
8010241c:	e8 fe f5 ff ff       	call   80101a1f <iput>
    return 0;
80102421:	b8 00 00 00 00       	mov    $0x0,%eax
80102426:	eb 03                	jmp    8010242b <namex+0x115>
  }
  return ip;
80102428:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
8010242b:	c9                   	leave  
8010242c:	c3                   	ret    

8010242d <namei>:

struct inode*
namei(char *path)
{
8010242d:	55                   	push   %ebp
8010242e:	89 e5                	mov    %esp,%ebp
80102430:	83 ec 28             	sub    $0x28,%esp
  char name[DIRSIZ];
  return namex(path, 0, name);
80102433:	8d 45 ea             	lea    -0x16(%ebp),%eax
80102436:	89 44 24 08          	mov    %eax,0x8(%esp)
8010243a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102441:	00 
80102442:	8b 45 08             	mov    0x8(%ebp),%eax
80102445:	89 04 24             	mov    %eax,(%esp)
80102448:	e8 c9 fe ff ff       	call   80102316 <namex>
}
8010244d:	c9                   	leave  
8010244e:	c3                   	ret    

8010244f <nameiparent>:

struct inode*
nameiparent(char *path, char *name)
{
8010244f:	55                   	push   %ebp
80102450:	89 e5                	mov    %esp,%ebp
80102452:	83 ec 18             	sub    $0x18,%esp
  return namex(path, 1, name);
80102455:	8b 45 0c             	mov    0xc(%ebp),%eax
80102458:	89 44 24 08          	mov    %eax,0x8(%esp)
8010245c:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80102463:	00 
80102464:	8b 45 08             	mov    0x8(%ebp),%eax
80102467:	89 04 24             	mov    %eax,(%esp)
8010246a:	e8 a7 fe ff ff       	call   80102316 <namex>
}
8010246f:	c9                   	leave  
80102470:	c3                   	ret    
80102471:	66 90                	xchg   %ax,%ax
80102473:	90                   	nop

80102474 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80102474:	55                   	push   %ebp
80102475:	89 e5                	mov    %esp,%ebp
80102477:	53                   	push   %ebx
80102478:	83 ec 14             	sub    $0x14,%esp
8010247b:	8b 45 08             	mov    0x8(%ebp),%eax
8010247e:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102482:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
80102486:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
8010248a:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
8010248e:	ec                   	in     (%dx),%al
8010248f:	89 c3                	mov    %eax,%ebx
80102491:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80102494:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
80102498:	83 c4 14             	add    $0x14,%esp
8010249b:	5b                   	pop    %ebx
8010249c:	5d                   	pop    %ebp
8010249d:	c3                   	ret    

8010249e <insl>:

static inline void
insl(int port, void *addr, int cnt)
{
8010249e:	55                   	push   %ebp
8010249f:	89 e5                	mov    %esp,%ebp
801024a1:	57                   	push   %edi
801024a2:	53                   	push   %ebx
  asm volatile("cld; rep insl" :
801024a3:	8b 55 08             	mov    0x8(%ebp),%edx
801024a6:	8b 4d 0c             	mov    0xc(%ebp),%ecx
801024a9:	8b 45 10             	mov    0x10(%ebp),%eax
801024ac:	89 cb                	mov    %ecx,%ebx
801024ae:	89 df                	mov    %ebx,%edi
801024b0:	89 c1                	mov    %eax,%ecx
801024b2:	fc                   	cld    
801024b3:	f3 6d                	rep insl (%dx),%es:(%edi)
801024b5:	89 c8                	mov    %ecx,%eax
801024b7:	89 fb                	mov    %edi,%ebx
801024b9:	89 5d 0c             	mov    %ebx,0xc(%ebp)
801024bc:	89 45 10             	mov    %eax,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "d" (port), "0" (addr), "1" (cnt) :
               "memory", "cc");
}
801024bf:	5b                   	pop    %ebx
801024c0:	5f                   	pop    %edi
801024c1:	5d                   	pop    %ebp
801024c2:	c3                   	ret    

801024c3 <outb>:

static inline void
outb(ushort port, uchar data)
{
801024c3:	55                   	push   %ebp
801024c4:	89 e5                	mov    %esp,%ebp
801024c6:	83 ec 08             	sub    $0x8,%esp
801024c9:	8b 55 08             	mov    0x8(%ebp),%edx
801024cc:	8b 45 0c             	mov    0xc(%ebp),%eax
801024cf:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
801024d3:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
801024d6:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
801024da:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
801024de:	ee                   	out    %al,(%dx)
}
801024df:	c9                   	leave  
801024e0:	c3                   	ret    

801024e1 <outsl>:
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
}

static inline void
outsl(int port, const void *addr, int cnt)
{
801024e1:	55                   	push   %ebp
801024e2:	89 e5                	mov    %esp,%ebp
801024e4:	56                   	push   %esi
801024e5:	53                   	push   %ebx
  asm volatile("cld; rep outsl" :
801024e6:	8b 55 08             	mov    0x8(%ebp),%edx
801024e9:	8b 4d 0c             	mov    0xc(%ebp),%ecx
801024ec:	8b 45 10             	mov    0x10(%ebp),%eax
801024ef:	89 cb                	mov    %ecx,%ebx
801024f1:	89 de                	mov    %ebx,%esi
801024f3:	89 c1                	mov    %eax,%ecx
801024f5:	fc                   	cld    
801024f6:	f3 6f                	rep outsl %ds:(%esi),(%dx)
801024f8:	89 c8                	mov    %ecx,%eax
801024fa:	89 f3                	mov    %esi,%ebx
801024fc:	89 5d 0c             	mov    %ebx,0xc(%ebp)
801024ff:	89 45 10             	mov    %eax,0x10(%ebp)
               "=S" (addr), "=c" (cnt) :
               "d" (port), "0" (addr), "1" (cnt) :
               "cc");
}
80102502:	5b                   	pop    %ebx
80102503:	5e                   	pop    %esi
80102504:	5d                   	pop    %ebp
80102505:	c3                   	ret    

80102506 <sti>:
  asm volatile("cli");
}

static inline void
sti(void)
{
80102506:	55                   	push   %ebp
80102507:	89 e5                	mov    %esp,%ebp
  asm volatile("sti");
80102509:	fb                   	sti    
}
8010250a:	5d                   	pop    %ebp
8010250b:	c3                   	ret    

8010250c <idewait>:
static void idestart(struct buf*);

// Wait for IDE disk to become ready.
static int
idewait(int checkerr)
{
8010250c:	55                   	push   %ebp
8010250d:	89 e5                	mov    %esp,%ebp
8010250f:	83 ec 14             	sub    $0x14,%esp
  int r;

  while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 
80102512:	90                   	nop
80102513:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
8010251a:	e8 55 ff ff ff       	call   80102474 <inb>
8010251f:	0f b6 c0             	movzbl %al,%eax
80102522:	89 45 fc             	mov    %eax,-0x4(%ebp)
80102525:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102528:	25 c0 00 00 00       	and    $0xc0,%eax
8010252d:	83 f8 40             	cmp    $0x40,%eax
80102530:	75 e1                	jne    80102513 <idewait+0x7>
    ;
  if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
80102532:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80102536:	74 11                	je     80102549 <idewait+0x3d>
80102538:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010253b:	83 e0 21             	and    $0x21,%eax
8010253e:	85 c0                	test   %eax,%eax
80102540:	74 07                	je     80102549 <idewait+0x3d>
    return -1;
80102542:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80102547:	eb 05                	jmp    8010254e <idewait+0x42>
  return 0;
80102549:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010254e:	c9                   	leave  
8010254f:	c3                   	ret    

80102550 <ideinit>:

void
ideinit(void)
{
80102550:	55                   	push   %ebp
80102551:	89 e5                	mov    %esp,%ebp
80102553:	83 ec 28             	sub    $0x28,%esp
  int i;

  initlock(&idelock, "ide");
80102556:	c7 44 24 04 74 94 10 	movl   $0x80109474,0x4(%esp)
8010255d:	80 
8010255e:	c7 04 24 60 c6 10 80 	movl   $0x8010c660,(%esp)
80102565:	e8 7c 36 00 00       	call   80105be6 <initlock>
  picenable(IRQ_IDE);
8010256a:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
80102571:	e8 d7 15 00 00       	call   80103b4d <picenable>
  ioapicenable(IRQ_IDE, ncpu - 1);
80102576:	a1 60 0f 11 80       	mov    0x80110f60,%eax
8010257b:	83 e8 01             	sub    $0x1,%eax
8010257e:	89 44 24 04          	mov    %eax,0x4(%esp)
80102582:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
80102589:	e8 f4 03 00 00       	call   80102982 <ioapicenable>
  idewait(0);
8010258e:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80102595:	e8 72 ff ff ff       	call   8010250c <idewait>
  
  // Check if disk 1 is present
  outb(0x1f6, 0xe0 | (1<<4));
8010259a:	c7 44 24 04 f0 00 00 	movl   $0xf0,0x4(%esp)
801025a1:	00 
801025a2:	c7 04 24 f6 01 00 00 	movl   $0x1f6,(%esp)
801025a9:	e8 15 ff ff ff       	call   801024c3 <outb>
  for(i=0; i<1000; i++){
801025ae:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801025b5:	eb 20                	jmp    801025d7 <ideinit+0x87>
    if(inb(0x1f7) != 0){
801025b7:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
801025be:	e8 b1 fe ff ff       	call   80102474 <inb>
801025c3:	84 c0                	test   %al,%al
801025c5:	74 0c                	je     801025d3 <ideinit+0x83>
      havedisk1 = 1;
801025c7:	c7 05 98 c6 10 80 01 	movl   $0x1,0x8010c698
801025ce:	00 00 00 
      break;
801025d1:	eb 0d                	jmp    801025e0 <ideinit+0x90>
  ioapicenable(IRQ_IDE, ncpu - 1);
  idewait(0);
  
  // Check if disk 1 is present
  outb(0x1f6, 0xe0 | (1<<4));
  for(i=0; i<1000; i++){
801025d3:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801025d7:	81 7d f4 e7 03 00 00 	cmpl   $0x3e7,-0xc(%ebp)
801025de:	7e d7                	jle    801025b7 <ideinit+0x67>
      break;
    }
  }
  
  // Switch back to disk 0.
  outb(0x1f6, 0xe0 | (0<<4));
801025e0:	c7 44 24 04 e0 00 00 	movl   $0xe0,0x4(%esp)
801025e7:	00 
801025e8:	c7 04 24 f6 01 00 00 	movl   $0x1f6,(%esp)
801025ef:	e8 cf fe ff ff       	call   801024c3 <outb>
}
801025f4:	c9                   	leave  
801025f5:	c3                   	ret    

801025f6 <idestart>:

// Start the request for b.  Caller must hold idelock.
static void
idestart(struct buf *b)
{
801025f6:	55                   	push   %ebp
801025f7:	89 e5                	mov    %esp,%ebp
801025f9:	83 ec 18             	sub    $0x18,%esp
  if(b == 0)
801025fc:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80102600:	75 0c                	jne    8010260e <idestart+0x18>
    panic("idestart");
80102602:	c7 04 24 78 94 10 80 	movl   $0x80109478,(%esp)
80102609:	e8 24 df ff ff       	call   80100532 <panic>

  idewait(0);
8010260e:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80102615:	e8 f2 fe ff ff       	call   8010250c <idewait>
  outb(0x3f6, 0);  // generate interrupt
8010261a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102621:	00 
80102622:	c7 04 24 f6 03 00 00 	movl   $0x3f6,(%esp)
80102629:	e8 95 fe ff ff       	call   801024c3 <outb>
  outb(0x1f2, 1);  // number of sectors
8010262e:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80102635:	00 
80102636:	c7 04 24 f2 01 00 00 	movl   $0x1f2,(%esp)
8010263d:	e8 81 fe ff ff       	call   801024c3 <outb>
  outb(0x1f3, b->sector & 0xff);
80102642:	8b 45 08             	mov    0x8(%ebp),%eax
80102645:	8b 40 08             	mov    0x8(%eax),%eax
80102648:	0f b6 c0             	movzbl %al,%eax
8010264b:	89 44 24 04          	mov    %eax,0x4(%esp)
8010264f:	c7 04 24 f3 01 00 00 	movl   $0x1f3,(%esp)
80102656:	e8 68 fe ff ff       	call   801024c3 <outb>
  outb(0x1f4, (b->sector >> 8) & 0xff);
8010265b:	8b 45 08             	mov    0x8(%ebp),%eax
8010265e:	8b 40 08             	mov    0x8(%eax),%eax
80102661:	c1 e8 08             	shr    $0x8,%eax
80102664:	0f b6 c0             	movzbl %al,%eax
80102667:	89 44 24 04          	mov    %eax,0x4(%esp)
8010266b:	c7 04 24 f4 01 00 00 	movl   $0x1f4,(%esp)
80102672:	e8 4c fe ff ff       	call   801024c3 <outb>
  outb(0x1f5, (b->sector >> 16) & 0xff);
80102677:	8b 45 08             	mov    0x8(%ebp),%eax
8010267a:	8b 40 08             	mov    0x8(%eax),%eax
8010267d:	c1 e8 10             	shr    $0x10,%eax
80102680:	0f b6 c0             	movzbl %al,%eax
80102683:	89 44 24 04          	mov    %eax,0x4(%esp)
80102687:	c7 04 24 f5 01 00 00 	movl   $0x1f5,(%esp)
8010268e:	e8 30 fe ff ff       	call   801024c3 <outb>
  outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f));
80102693:	8b 45 08             	mov    0x8(%ebp),%eax
80102696:	8b 40 04             	mov    0x4(%eax),%eax
80102699:	83 e0 01             	and    $0x1,%eax
8010269c:	89 c2                	mov    %eax,%edx
8010269e:	c1 e2 04             	shl    $0x4,%edx
801026a1:	8b 45 08             	mov    0x8(%ebp),%eax
801026a4:	8b 40 08             	mov    0x8(%eax),%eax
801026a7:	c1 e8 18             	shr    $0x18,%eax
801026aa:	83 e0 0f             	and    $0xf,%eax
801026ad:	09 d0                	or     %edx,%eax
801026af:	83 c8 e0             	or     $0xffffffe0,%eax
801026b2:	0f b6 c0             	movzbl %al,%eax
801026b5:	89 44 24 04          	mov    %eax,0x4(%esp)
801026b9:	c7 04 24 f6 01 00 00 	movl   $0x1f6,(%esp)
801026c0:	e8 fe fd ff ff       	call   801024c3 <outb>
  if(b->flags & B_DIRTY){
801026c5:	8b 45 08             	mov    0x8(%ebp),%eax
801026c8:	8b 00                	mov    (%eax),%eax
801026ca:	83 e0 04             	and    $0x4,%eax
801026cd:	85 c0                	test   %eax,%eax
801026cf:	74 34                	je     80102705 <idestart+0x10f>
    outb(0x1f7, IDE_CMD_WRITE);
801026d1:	c7 44 24 04 30 00 00 	movl   $0x30,0x4(%esp)
801026d8:	00 
801026d9:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
801026e0:	e8 de fd ff ff       	call   801024c3 <outb>
    outsl(0x1f0, b->data, 512/4);
801026e5:	8b 45 08             	mov    0x8(%ebp),%eax
801026e8:	83 c0 18             	add    $0x18,%eax
801026eb:	c7 44 24 08 80 00 00 	movl   $0x80,0x8(%esp)
801026f2:	00 
801026f3:	89 44 24 04          	mov    %eax,0x4(%esp)
801026f7:	c7 04 24 f0 01 00 00 	movl   $0x1f0,(%esp)
801026fe:	e8 de fd ff ff       	call   801024e1 <outsl>
80102703:	eb 14                	jmp    80102719 <idestart+0x123>
  } else {
    outb(0x1f7, IDE_CMD_READ);
80102705:	c7 44 24 04 20 00 00 	movl   $0x20,0x4(%esp)
8010270c:	00 
8010270d:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
80102714:	e8 aa fd ff ff       	call   801024c3 <outb>
  }
}
80102719:	c9                   	leave  
8010271a:	c3                   	ret    

8010271b <ideintr>:

// Interrupt handler.
void
ideintr(void)
{
8010271b:	55                   	push   %ebp
8010271c:	89 e5                	mov    %esp,%ebp
8010271e:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  // First queued buffer is the active request.
  acquire(&idelock);
80102721:	c7 04 24 60 c6 10 80 	movl   $0x8010c660,(%esp)
80102728:	e8 da 34 00 00       	call   80105c07 <acquire>
  if((b = idequeue) == 0){
8010272d:	a1 94 c6 10 80       	mov    0x8010c694,%eax
80102732:	89 45 f4             	mov    %eax,-0xc(%ebp)
80102735:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80102739:	75 11                	jne    8010274c <ideintr+0x31>
    release(&idelock);
8010273b:	c7 04 24 60 c6 10 80 	movl   $0x8010c660,(%esp)
80102742:	e8 22 35 00 00       	call   80105c69 <release>
    // cprintf("spurious IDE interrupt\n");
    return;
80102747:	e9 85 00 00 00       	jmp    801027d1 <ideintr+0xb6>
  }
  idequeue = b->qnext;
8010274c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010274f:	8b 40 14             	mov    0x14(%eax),%eax
80102752:	a3 94 c6 10 80       	mov    %eax,0x8010c694

  // Read data if needed.
  if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
80102757:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010275a:	8b 00                	mov    (%eax),%eax
8010275c:	83 e0 04             	and    $0x4,%eax
8010275f:	85 c0                	test   %eax,%eax
80102761:	75 2e                	jne    80102791 <ideintr+0x76>
80102763:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
8010276a:	e8 9d fd ff ff       	call   8010250c <idewait>
8010276f:	85 c0                	test   %eax,%eax
80102771:	78 1e                	js     80102791 <ideintr+0x76>
    insl(0x1f0, b->data, 512/4);
80102773:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102776:	83 c0 18             	add    $0x18,%eax
80102779:	c7 44 24 08 80 00 00 	movl   $0x80,0x8(%esp)
80102780:	00 
80102781:	89 44 24 04          	mov    %eax,0x4(%esp)
80102785:	c7 04 24 f0 01 00 00 	movl   $0x1f0,(%esp)
8010278c:	e8 0d fd ff ff       	call   8010249e <insl>
  
  // Wake process waiting for this buf.
  b->flags |= B_VALID;
80102791:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102794:	8b 00                	mov    (%eax),%eax
80102796:	89 c2                	mov    %eax,%edx
80102798:	83 ca 02             	or     $0x2,%edx
8010279b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010279e:	89 10                	mov    %edx,(%eax)
  b->flags &= ~B_DIRTY;
801027a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801027a3:	8b 00                	mov    (%eax),%eax
801027a5:	89 c2                	mov    %eax,%edx
801027a7:	83 e2 fb             	and    $0xfffffffb,%edx
801027aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
801027ad:	89 10                	mov    %edx,(%eax)
  // Start disk on next buf in queue.
  if(idequeue != 0)
801027af:	a1 94 c6 10 80       	mov    0x8010c694,%eax
801027b4:	85 c0                	test   %eax,%eax
801027b6:	74 0d                	je     801027c5 <ideintr+0xaa>
    idestart(idequeue);
801027b8:	a1 94 c6 10 80       	mov    0x8010c694,%eax
801027bd:	89 04 24             	mov    %eax,(%esp)
801027c0:	e8 31 fe ff ff       	call   801025f6 <idestart>

  release(&idelock);
801027c5:	c7 04 24 60 c6 10 80 	movl   $0x8010c660,(%esp)
801027cc:	e8 98 34 00 00       	call   80105c69 <release>
}
801027d1:	c9                   	leave  
801027d2:	c3                   	ret    

801027d3 <iderw>:
// Sync buf with disk. 
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
801027d3:	55                   	push   %ebp
801027d4:	89 e5                	mov    %esp,%ebp
801027d6:	83 ec 28             	sub    $0x28,%esp
  struct buf **pp;

  if(!(b->flags & B_BUSY))
801027d9:	8b 45 08             	mov    0x8(%ebp),%eax
801027dc:	8b 00                	mov    (%eax),%eax
801027de:	83 e0 01             	and    $0x1,%eax
801027e1:	85 c0                	test   %eax,%eax
801027e3:	75 0c                	jne    801027f1 <iderw+0x1e>
    panic("iderw: buf not busy");
801027e5:	c7 04 24 81 94 10 80 	movl   $0x80109481,(%esp)
801027ec:	e8 41 dd ff ff       	call   80100532 <panic>
  if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
801027f1:	8b 45 08             	mov    0x8(%ebp),%eax
801027f4:	8b 00                	mov    (%eax),%eax
801027f6:	83 e0 06             	and    $0x6,%eax
801027f9:	83 f8 02             	cmp    $0x2,%eax
801027fc:	75 0c                	jne    8010280a <iderw+0x37>
    panic("iderw: nothing to do");
801027fe:	c7 04 24 95 94 10 80 	movl   $0x80109495,(%esp)
80102805:	e8 28 dd ff ff       	call   80100532 <panic>
  if(b->dev != 0 && !havedisk1)
8010280a:	8b 45 08             	mov    0x8(%ebp),%eax
8010280d:	8b 40 04             	mov    0x4(%eax),%eax
80102810:	85 c0                	test   %eax,%eax
80102812:	74 15                	je     80102829 <iderw+0x56>
80102814:	a1 98 c6 10 80       	mov    0x8010c698,%eax
80102819:	85 c0                	test   %eax,%eax
8010281b:	75 0c                	jne    80102829 <iderw+0x56>
    panic("iderw: ide disk 1 not present");
8010281d:	c7 04 24 aa 94 10 80 	movl   $0x801094aa,(%esp)
80102824:	e8 09 dd ff ff       	call   80100532 <panic>

  acquire(&idelock);  //DOC: acquire-lock
80102829:	c7 04 24 60 c6 10 80 	movl   $0x8010c660,(%esp)
80102830:	e8 d2 33 00 00       	call   80105c07 <acquire>

  // Append b to idequeue.
  b->qnext = 0;
80102835:	8b 45 08             	mov    0x8(%ebp),%eax
80102838:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
  for(pp=&idequeue; *pp; pp=&(*pp)->qnext)  //DOC: insert-queue
8010283f:	c7 45 f4 94 c6 10 80 	movl   $0x8010c694,-0xc(%ebp)
80102846:	eb 0b                	jmp    80102853 <iderw+0x80>
80102848:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010284b:	8b 00                	mov    (%eax),%eax
8010284d:	83 c0 14             	add    $0x14,%eax
80102850:	89 45 f4             	mov    %eax,-0xc(%ebp)
80102853:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102856:	8b 00                	mov    (%eax),%eax
80102858:	85 c0                	test   %eax,%eax
8010285a:	75 ec                	jne    80102848 <iderw+0x75>
    ;
  *pp = b;
8010285c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010285f:	8b 55 08             	mov    0x8(%ebp),%edx
80102862:	89 10                	mov    %edx,(%eax)
  
  // Start disk if necessary.
  if(idequeue == b)
80102864:	a1 94 c6 10 80       	mov    0x8010c694,%eax
80102869:	3b 45 08             	cmp    0x8(%ebp),%eax
8010286c:	75 0b                	jne    80102879 <iderw+0xa6>
    idestart(b);
8010286e:	8b 45 08             	mov    0x8(%ebp),%eax
80102871:	89 04 24             	mov    %eax,(%esp)
80102874:	e8 7d fd ff ff       	call   801025f6 <idestart>
  // Wait for request to finish.
  release(&idelock);
80102879:	c7 04 24 60 c6 10 80 	movl   $0x8010c660,(%esp)
80102880:	e8 e4 33 00 00       	call   80105c69 <release>
  sti();
80102885:	e8 7c fc ff ff       	call   80102506 <sti>
    while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ };
8010288a:	90                   	nop
8010288b:	8b 45 08             	mov    0x8(%ebp),%eax
8010288e:	8b 00                	mov    (%eax),%eax
80102890:	83 e0 06             	and    $0x6,%eax
80102893:	83 f8 02             	cmp    $0x2,%eax
80102896:	75 f3                	jne    8010288b <iderw+0xb8>

}
80102898:	c9                   	leave  
80102899:	c3                   	ret    
8010289a:	66 90                	xchg   %ax,%ax

8010289c <ioapicread>:
  uint data;
};

static uint
ioapicread(int reg)
{
8010289c:	55                   	push   %ebp
8010289d:	89 e5                	mov    %esp,%ebp
  ioapic->reg = reg;
8010289f:	a1 94 08 11 80       	mov    0x80110894,%eax
801028a4:	8b 55 08             	mov    0x8(%ebp),%edx
801028a7:	89 10                	mov    %edx,(%eax)
  return ioapic->data;
801028a9:	a1 94 08 11 80       	mov    0x80110894,%eax
801028ae:	8b 40 10             	mov    0x10(%eax),%eax
}
801028b1:	5d                   	pop    %ebp
801028b2:	c3                   	ret    

801028b3 <ioapicwrite>:

static void
ioapicwrite(int reg, uint data)
{
801028b3:	55                   	push   %ebp
801028b4:	89 e5                	mov    %esp,%ebp
  ioapic->reg = reg;
801028b6:	a1 94 08 11 80       	mov    0x80110894,%eax
801028bb:	8b 55 08             	mov    0x8(%ebp),%edx
801028be:	89 10                	mov    %edx,(%eax)
  ioapic->data = data;
801028c0:	a1 94 08 11 80       	mov    0x80110894,%eax
801028c5:	8b 55 0c             	mov    0xc(%ebp),%edx
801028c8:	89 50 10             	mov    %edx,0x10(%eax)
}
801028cb:	5d                   	pop    %ebp
801028cc:	c3                   	ret    

801028cd <ioapicinit>:

void
ioapicinit(void)
{
801028cd:	55                   	push   %ebp
801028ce:	89 e5                	mov    %esp,%ebp
801028d0:	83 ec 28             	sub    $0x28,%esp
  int i, id, maxintr;

  if(!ismp)
801028d3:	a1 64 09 11 80       	mov    0x80110964,%eax
801028d8:	85 c0                	test   %eax,%eax
801028da:	0f 84 9f 00 00 00    	je     8010297f <ioapicinit+0xb2>
    return;

  ioapic = (volatile struct ioapic*)IOAPIC;
801028e0:	c7 05 94 08 11 80 00 	movl   $0xfec00000,0x80110894
801028e7:	00 c0 fe 
  maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
801028ea:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801028f1:	e8 a6 ff ff ff       	call   8010289c <ioapicread>
801028f6:	c1 e8 10             	shr    $0x10,%eax
801028f9:	25 ff 00 00 00       	and    $0xff,%eax
801028fe:	89 45 f0             	mov    %eax,-0x10(%ebp)
  id = ioapicread(REG_ID) >> 24;
80102901:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80102908:	e8 8f ff ff ff       	call   8010289c <ioapicread>
8010290d:	c1 e8 18             	shr    $0x18,%eax
80102910:	89 45 ec             	mov    %eax,-0x14(%ebp)
  if(id != ioapicid)
80102913:	0f b6 05 60 09 11 80 	movzbl 0x80110960,%eax
8010291a:	0f b6 c0             	movzbl %al,%eax
8010291d:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80102920:	74 0c                	je     8010292e <ioapicinit+0x61>
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
80102922:	c7 04 24 c8 94 10 80 	movl   $0x801094c8,(%esp)
80102929:	e8 68 da ff ff       	call   80100396 <cprintf>

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
8010292e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80102935:	eb 3e                	jmp    80102975 <ioapicinit+0xa8>
    ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
80102937:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010293a:	83 c0 20             	add    $0x20,%eax
8010293d:	0d 00 00 01 00       	or     $0x10000,%eax
80102942:	8b 55 f4             	mov    -0xc(%ebp),%edx
80102945:	83 c2 08             	add    $0x8,%edx
80102948:	01 d2                	add    %edx,%edx
8010294a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010294e:	89 14 24             	mov    %edx,(%esp)
80102951:	e8 5d ff ff ff       	call   801028b3 <ioapicwrite>
    ioapicwrite(REG_TABLE+2*i+1, 0);
80102956:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102959:	83 c0 08             	add    $0x8,%eax
8010295c:	01 c0                	add    %eax,%eax
8010295e:	83 c0 01             	add    $0x1,%eax
80102961:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102968:	00 
80102969:	89 04 24             	mov    %eax,(%esp)
8010296c:	e8 42 ff ff ff       	call   801028b3 <ioapicwrite>
  if(id != ioapicid)
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
80102971:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80102975:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102978:	3b 45 f0             	cmp    -0x10(%ebp),%eax
8010297b:	7e ba                	jle    80102937 <ioapicinit+0x6a>
8010297d:	eb 01                	jmp    80102980 <ioapicinit+0xb3>
ioapicinit(void)
{
  int i, id, maxintr;

  if(!ismp)
    return;
8010297f:	90                   	nop
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
    ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
    ioapicwrite(REG_TABLE+2*i+1, 0);
  }
}
80102980:	c9                   	leave  
80102981:	c3                   	ret    

80102982 <ioapicenable>:

void
ioapicenable(int irq, int cpunum)
{
80102982:	55                   	push   %ebp
80102983:	89 e5                	mov    %esp,%ebp
80102985:	83 ec 08             	sub    $0x8,%esp
  if(!ismp)
80102988:	a1 64 09 11 80       	mov    0x80110964,%eax
8010298d:	85 c0                	test   %eax,%eax
8010298f:	74 39                	je     801029ca <ioapicenable+0x48>
    return;

  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
80102991:	8b 45 08             	mov    0x8(%ebp),%eax
80102994:	83 c0 20             	add    $0x20,%eax
80102997:	8b 55 08             	mov    0x8(%ebp),%edx
8010299a:	83 c2 08             	add    $0x8,%edx
8010299d:	01 d2                	add    %edx,%edx
8010299f:	89 44 24 04          	mov    %eax,0x4(%esp)
801029a3:	89 14 24             	mov    %edx,(%esp)
801029a6:	e8 08 ff ff ff       	call   801028b3 <ioapicwrite>
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801029ab:	8b 45 0c             	mov    0xc(%ebp),%eax
801029ae:	c1 e0 18             	shl    $0x18,%eax
801029b1:	8b 55 08             	mov    0x8(%ebp),%edx
801029b4:	83 c2 08             	add    $0x8,%edx
801029b7:	01 d2                	add    %edx,%edx
801029b9:	83 c2 01             	add    $0x1,%edx
801029bc:	89 44 24 04          	mov    %eax,0x4(%esp)
801029c0:	89 14 24             	mov    %edx,(%esp)
801029c3:	e8 eb fe ff ff       	call   801028b3 <ioapicwrite>
801029c8:	eb 01                	jmp    801029cb <ioapicenable+0x49>

void
ioapicenable(int irq, int cpunum)
{
  if(!ismp)
    return;
801029ca:	90                   	nop
  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
}
801029cb:	c9                   	leave  
801029cc:	c3                   	ret    
801029cd:	66 90                	xchg   %ax,%ax
801029cf:	90                   	nop

801029d0 <v2p>:
#define KERNBASE 0x80000000         // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM)  // Address where kernel is linked

#ifndef __ASSEMBLER__

static inline uint v2p(void *a) { return ((uint) (a))  - KERNBASE; }
801029d0:	55                   	push   %ebp
801029d1:	89 e5                	mov    %esp,%ebp
801029d3:	8b 45 08             	mov    0x8(%ebp),%eax
801029d6:	05 00 00 00 80       	add    $0x80000000,%eax
801029db:	5d                   	pop    %ebp
801029dc:	c3                   	ret    

801029dd <kinit1>:
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
801029dd:	55                   	push   %ebp
801029de:	89 e5                	mov    %esp,%ebp
801029e0:	83 ec 18             	sub    $0x18,%esp
  initlock(&kmem.lock, "kmem");
801029e3:	c7 44 24 04 fa 94 10 	movl   $0x801094fa,0x4(%esp)
801029ea:	80 
801029eb:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
801029f2:	e8 ef 31 00 00       	call   80105be6 <initlock>
  kmem.use_lock = 0;
801029f7:	c7 05 d4 08 11 80 00 	movl   $0x0,0x801108d4
801029fe:	00 00 00 
  freerange(vstart, vend);
80102a01:	8b 45 0c             	mov    0xc(%ebp),%eax
80102a04:	89 44 24 04          	mov    %eax,0x4(%esp)
80102a08:	8b 45 08             	mov    0x8(%ebp),%eax
80102a0b:	89 04 24             	mov    %eax,(%esp)
80102a0e:	e8 26 00 00 00       	call   80102a39 <freerange>
}
80102a13:	c9                   	leave  
80102a14:	c3                   	ret    

80102a15 <kinit2>:

void
kinit2(void *vstart, void *vend)
{
80102a15:	55                   	push   %ebp
80102a16:	89 e5                	mov    %esp,%ebp
80102a18:	83 ec 18             	sub    $0x18,%esp
  freerange(vstart, vend);
80102a1b:	8b 45 0c             	mov    0xc(%ebp),%eax
80102a1e:	89 44 24 04          	mov    %eax,0x4(%esp)
80102a22:	8b 45 08             	mov    0x8(%ebp),%eax
80102a25:	89 04 24             	mov    %eax,(%esp)
80102a28:	e8 0c 00 00 00       	call   80102a39 <freerange>
  kmem.use_lock = 1;
80102a2d:	c7 05 d4 08 11 80 01 	movl   $0x1,0x801108d4
80102a34:	00 00 00 
}
80102a37:	c9                   	leave  
80102a38:	c3                   	ret    

80102a39 <freerange>:

void
freerange(void *vstart, void *vend)
{
80102a39:	55                   	push   %ebp
80102a3a:	89 e5                	mov    %esp,%ebp
80102a3c:	83 ec 28             	sub    $0x28,%esp
  char *p;
  p = (char*)PGROUNDUP((uint)vstart);
80102a3f:	8b 45 08             	mov    0x8(%ebp),%eax
80102a42:	05 ff 0f 00 00       	add    $0xfff,%eax
80102a47:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80102a4c:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a4f:	eb 12                	jmp    80102a63 <freerange+0x2a>
    kfree(p);
80102a51:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102a54:	89 04 24             	mov    %eax,(%esp)
80102a57:	e8 16 00 00 00       	call   80102a72 <kfree>
void
freerange(void *vstart, void *vend)
{
  char *p;
  p = (char*)PGROUNDUP((uint)vstart);
  for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a5c:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80102a63:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102a66:	05 00 10 00 00       	add    $0x1000,%eax
80102a6b:	3b 45 0c             	cmp    0xc(%ebp),%eax
80102a6e:	76 e1                	jbe    80102a51 <freerange+0x18>
    kfree(p);
}
80102a70:	c9                   	leave  
80102a71:	c3                   	ret    

80102a72 <kfree>:
// which normally should have been returned by a
// call to kalloc().  (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v)
{
80102a72:	55                   	push   %ebp
80102a73:	89 e5                	mov    %esp,%ebp
80102a75:	83 ec 28             	sub    $0x28,%esp
  struct run *r;

  if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP)
80102a78:	8b 45 08             	mov    0x8(%ebp),%eax
80102a7b:	25 ff 0f 00 00       	and    $0xfff,%eax
80102a80:	85 c0                	test   %eax,%eax
80102a82:	75 1b                	jne    80102a9f <kfree+0x2d>
80102a84:	81 7d 08 9c 7a 11 80 	cmpl   $0x80117a9c,0x8(%ebp)
80102a8b:	72 12                	jb     80102a9f <kfree+0x2d>
80102a8d:	8b 45 08             	mov    0x8(%ebp),%eax
80102a90:	89 04 24             	mov    %eax,(%esp)
80102a93:	e8 38 ff ff ff       	call   801029d0 <v2p>
80102a98:	3d ff ff ff 0d       	cmp    $0xdffffff,%eax
80102a9d:	76 67                	jbe    80102b06 <kfree+0x94>
  {
    cprintf("1 %d\n",(uint)v % PGSIZE);
80102a9f:	8b 45 08             	mov    0x8(%ebp),%eax
80102aa2:	25 ff 0f 00 00       	and    $0xfff,%eax
80102aa7:	89 44 24 04          	mov    %eax,0x4(%esp)
80102aab:	c7 04 24 ff 94 10 80 	movl   $0x801094ff,(%esp)
80102ab2:	e8 df d8 ff ff       	call   80100396 <cprintf>
    cprintf("2 %d\n",(v<end));
80102ab7:	81 7d 08 9c 7a 11 80 	cmpl   $0x80117a9c,0x8(%ebp)
80102abe:	0f 92 c0             	setb   %al
80102ac1:	0f b6 c0             	movzbl %al,%eax
80102ac4:	89 44 24 04          	mov    %eax,0x4(%esp)
80102ac8:	c7 04 24 05 95 10 80 	movl   $0x80109505,(%esp)
80102acf:	e8 c2 d8 ff ff       	call   80100396 <cprintf>
    cprintf("3 %d\n",(v2p(v) >=PHYSTOP));
80102ad4:	8b 45 08             	mov    0x8(%ebp),%eax
80102ad7:	89 04 24             	mov    %eax,(%esp)
80102ada:	e8 f1 fe ff ff       	call   801029d0 <v2p>
80102adf:	3d ff ff ff 0d       	cmp    $0xdffffff,%eax
80102ae4:	0f 97 c0             	seta   %al
80102ae7:	0f b6 c0             	movzbl %al,%eax
80102aea:	89 44 24 04          	mov    %eax,0x4(%esp)
80102aee:	c7 04 24 0b 95 10 80 	movl   $0x8010950b,(%esp)
80102af5:	e8 9c d8 ff ff       	call   80100396 <cprintf>
    panic("kfree");
80102afa:	c7 04 24 11 95 10 80 	movl   $0x80109511,(%esp)
80102b01:	e8 2c da ff ff       	call   80100532 <panic>
  }

  // Fill with junk to catch dangling refs.
  memset(v, 1, PGSIZE);
80102b06:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80102b0d:	00 
80102b0e:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80102b15:	00 
80102b16:	8b 45 08             	mov    0x8(%ebp),%eax
80102b19:	89 04 24             	mov    %eax,(%esp)
80102b1c:	e8 41 33 00 00       	call   80105e62 <memset>

  if(kmem.use_lock)
80102b21:	a1 d4 08 11 80       	mov    0x801108d4,%eax
80102b26:	85 c0                	test   %eax,%eax
80102b28:	74 0c                	je     80102b36 <kfree+0xc4>
    acquire(&kmem.lock);
80102b2a:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
80102b31:	e8 d1 30 00 00       	call   80105c07 <acquire>
  r = (struct run*)v;
80102b36:	8b 45 08             	mov    0x8(%ebp),%eax
80102b39:	89 45 f4             	mov    %eax,-0xc(%ebp)
  r->next = kmem.freelist;
80102b3c:	8b 15 d8 08 11 80    	mov    0x801108d8,%edx
80102b42:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b45:	89 10                	mov    %edx,(%eax)
  kmem.freelist = r;
80102b47:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b4a:	a3 d8 08 11 80       	mov    %eax,0x801108d8
  if(kmem.use_lock)
80102b4f:	a1 d4 08 11 80       	mov    0x801108d4,%eax
80102b54:	85 c0                	test   %eax,%eax
80102b56:	74 0c                	je     80102b64 <kfree+0xf2>
    release(&kmem.lock);
80102b58:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
80102b5f:	e8 05 31 00 00       	call   80105c69 <release>
}
80102b64:	c9                   	leave  
80102b65:	c3                   	ret    

80102b66 <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(void)
{
80102b66:	55                   	push   %ebp
80102b67:	89 e5                	mov    %esp,%ebp
80102b69:	83 ec 28             	sub    $0x28,%esp
  struct run *r;

  if(kmem.use_lock)
80102b6c:	a1 d4 08 11 80       	mov    0x801108d4,%eax
80102b71:	85 c0                	test   %eax,%eax
80102b73:	74 0c                	je     80102b81 <kalloc+0x1b>
    acquire(&kmem.lock);
80102b75:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
80102b7c:	e8 86 30 00 00       	call   80105c07 <acquire>
  r = kmem.freelist;
80102b81:	a1 d8 08 11 80       	mov    0x801108d8,%eax
80102b86:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(r)
80102b89:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80102b8d:	74 0a                	je     80102b99 <kalloc+0x33>
    kmem.freelist = r->next;
80102b8f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b92:	8b 00                	mov    (%eax),%eax
80102b94:	a3 d8 08 11 80       	mov    %eax,0x801108d8
  if(kmem.use_lock)
80102b99:	a1 d4 08 11 80       	mov    0x801108d4,%eax
80102b9e:	85 c0                	test   %eax,%eax
80102ba0:	74 0c                	je     80102bae <kalloc+0x48>
    release(&kmem.lock);
80102ba2:	c7 04 24 a0 08 11 80 	movl   $0x801108a0,(%esp)
80102ba9:	e8 bb 30 00 00       	call   80105c69 <release>
  return (char*)r;
80102bae:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80102bb1:	c9                   	leave  
80102bb2:	c3                   	ret    
80102bb3:	90                   	nop

80102bb4 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80102bb4:	55                   	push   %ebp
80102bb5:	89 e5                	mov    %esp,%ebp
80102bb7:	53                   	push   %ebx
80102bb8:	83 ec 14             	sub    $0x14,%esp
80102bbb:	8b 45 08             	mov    0x8(%ebp),%eax
80102bbe:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102bc2:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
80102bc6:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
80102bca:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
80102bce:	ec                   	in     (%dx),%al
80102bcf:	89 c3                	mov    %eax,%ebx
80102bd1:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80102bd4:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
80102bd8:	83 c4 14             	add    $0x14,%esp
80102bdb:	5b                   	pop    %ebx
80102bdc:	5d                   	pop    %ebp
80102bdd:	c3                   	ret    

80102bde <kbdgetc>:
#include "defs.h"
#include "kbd.h"

int
kbdgetc(void)
{
80102bde:	55                   	push   %ebp
80102bdf:	89 e5                	mov    %esp,%ebp
80102be1:	83 ec 14             	sub    $0x14,%esp
  static uchar *charcode[4] = {
    normalmap, shiftmap, ctlmap, ctlmap
  };
  uint st, data, c;

  st = inb(KBSTATP);
80102be4:	c7 04 24 64 00 00 00 	movl   $0x64,(%esp)
80102beb:	e8 c4 ff ff ff       	call   80102bb4 <inb>
80102bf0:	0f b6 c0             	movzbl %al,%eax
80102bf3:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if((st & KBS_DIB) == 0)
80102bf6:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102bf9:	83 e0 01             	and    $0x1,%eax
80102bfc:	85 c0                	test   %eax,%eax
80102bfe:	75 0a                	jne    80102c0a <kbdgetc+0x2c>
    return -1;
80102c00:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80102c05:	e9 25 01 00 00       	jmp    80102d2f <kbdgetc+0x151>
  data = inb(KBDATAP);
80102c0a:	c7 04 24 60 00 00 00 	movl   $0x60,(%esp)
80102c11:	e8 9e ff ff ff       	call   80102bb4 <inb>
80102c16:	0f b6 c0             	movzbl %al,%eax
80102c19:	89 45 fc             	mov    %eax,-0x4(%ebp)

  if(data == 0xE0){
80102c1c:	81 7d fc e0 00 00 00 	cmpl   $0xe0,-0x4(%ebp)
80102c23:	75 17                	jne    80102c3c <kbdgetc+0x5e>
    shift |= E0ESC;
80102c25:	a1 9c c6 10 80       	mov    0x8010c69c,%eax
80102c2a:	83 c8 40             	or     $0x40,%eax
80102c2d:	a3 9c c6 10 80       	mov    %eax,0x8010c69c
    return 0;
80102c32:	b8 00 00 00 00       	mov    $0x0,%eax
80102c37:	e9 f3 00 00 00       	jmp    80102d2f <kbdgetc+0x151>
  } else if(data & 0x80){
80102c3c:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102c3f:	25 80 00 00 00       	and    $0x80,%eax
80102c44:	85 c0                	test   %eax,%eax
80102c46:	74 45                	je     80102c8d <kbdgetc+0xaf>
    // Key released
    data = (shift & E0ESC ? data : data & 0x7F);
80102c48:	a1 9c c6 10 80       	mov    0x8010c69c,%eax
80102c4d:	83 e0 40             	and    $0x40,%eax
80102c50:	85 c0                	test   %eax,%eax
80102c52:	75 08                	jne    80102c5c <kbdgetc+0x7e>
80102c54:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102c57:	83 e0 7f             	and    $0x7f,%eax
80102c5a:	eb 03                	jmp    80102c5f <kbdgetc+0x81>
80102c5c:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102c5f:	89 45 fc             	mov    %eax,-0x4(%ebp)
    shift &= ~(shiftcode[data] | E0ESC);
80102c62:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102c65:	05 20 a0 10 80       	add    $0x8010a020,%eax
80102c6a:	0f b6 00             	movzbl (%eax),%eax
80102c6d:	83 c8 40             	or     $0x40,%eax
80102c70:	0f b6 c0             	movzbl %al,%eax
80102c73:	f7 d0                	not    %eax
80102c75:	89 c2                	mov    %eax,%edx
80102c77:	a1 9c c6 10 80       	mov    0x8010c69c,%eax
80102c7c:	21 d0                	and    %edx,%eax
80102c7e:	a3 9c c6 10 80       	mov    %eax,0x8010c69c
    return 0;
80102c83:	b8 00 00 00 00       	mov    $0x0,%eax
80102c88:	e9 a2 00 00 00       	jmp    80102d2f <kbdgetc+0x151>
  } else if(shift & E0ESC){
80102c8d:	a1 9c c6 10 80       	mov    0x8010c69c,%eax
80102c92:	83 e0 40             	and    $0x40,%eax
80102c95:	85 c0                	test   %eax,%eax
80102c97:	74 14                	je     80102cad <kbdgetc+0xcf>
    // Last character was an E0 escape; or with 0x80
    data |= 0x80;
80102c99:	81 4d fc 80 00 00 00 	orl    $0x80,-0x4(%ebp)
    shift &= ~E0ESC;
80102ca0:	a1 9c c6 10 80       	mov    0x8010c69c,%eax
80102ca5:	83 e0 bf             	and    $0xffffffbf,%eax
80102ca8:	a3 9c c6 10 80       	mov    %eax,0x8010c69c
  }

  shift |= shiftcode[data];
80102cad:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102cb0:	05 20 a0 10 80       	add    $0x8010a020,%eax
80102cb5:	0f b6 00             	movzbl (%eax),%eax
80102cb8:	0f b6 d0             	movzbl %al,%edx
80102cbb:	a1 9c c6 10 80       	mov    0x8010c69c,%eax
80102cc0:	09 d0                	or     %edx,%eax
80102cc2:	a3 9c c6 10 80       	mov    %eax,0x8010c69c
  shift ^= togglecode[data];
80102cc7:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102cca:	05 20 a1 10 80       	add    $0x8010a120,%eax
80102ccf:	0f b6 00             	movzbl (%eax),%eax
80102cd2:	0f b6 d0             	movzbl %al,%edx
80102cd5:	a1 9c c6 10 80       	mov    0x8010c69c,%eax
80102cda:	31 d0                	xor    %edx,%eax
80102cdc:	a3 9c c6 10 80       	mov    %eax,0x8010c69c
  c = charcode[shift & (CTL | SHIFT)][data];
80102ce1:	a1 9c c6 10 80       	mov    0x8010c69c,%eax
80102ce6:	83 e0 03             	and    $0x3,%eax
80102ce9:	8b 14 85 20 a5 10 80 	mov    -0x7fef5ae0(,%eax,4),%edx
80102cf0:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102cf3:	01 d0                	add    %edx,%eax
80102cf5:	0f b6 00             	movzbl (%eax),%eax
80102cf8:	0f b6 c0             	movzbl %al,%eax
80102cfb:	89 45 f8             	mov    %eax,-0x8(%ebp)
  if(shift & CAPSLOCK){
80102cfe:	a1 9c c6 10 80       	mov    0x8010c69c,%eax
80102d03:	83 e0 08             	and    $0x8,%eax
80102d06:	85 c0                	test   %eax,%eax
80102d08:	74 22                	je     80102d2c <kbdgetc+0x14e>
    if('a' <= c && c <= 'z')
80102d0a:	83 7d f8 60          	cmpl   $0x60,-0x8(%ebp)
80102d0e:	76 0c                	jbe    80102d1c <kbdgetc+0x13e>
80102d10:	83 7d f8 7a          	cmpl   $0x7a,-0x8(%ebp)
80102d14:	77 06                	ja     80102d1c <kbdgetc+0x13e>
      c += 'A' - 'a';
80102d16:	83 6d f8 20          	subl   $0x20,-0x8(%ebp)
80102d1a:	eb 10                	jmp    80102d2c <kbdgetc+0x14e>
    else if('A' <= c && c <= 'Z')
80102d1c:	83 7d f8 40          	cmpl   $0x40,-0x8(%ebp)
80102d20:	76 0a                	jbe    80102d2c <kbdgetc+0x14e>
80102d22:	83 7d f8 5a          	cmpl   $0x5a,-0x8(%ebp)
80102d26:	77 04                	ja     80102d2c <kbdgetc+0x14e>
      c += 'a' - 'A';
80102d28:	83 45 f8 20          	addl   $0x20,-0x8(%ebp)
  }
  return c;
80102d2c:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80102d2f:	c9                   	leave  
80102d30:	c3                   	ret    

80102d31 <kbdintr>:

void
kbdintr(void)
{
80102d31:	55                   	push   %ebp
80102d32:	89 e5                	mov    %esp,%ebp
80102d34:	83 ec 18             	sub    $0x18,%esp
  consoleintr(kbdgetc);
80102d37:	c7 04 24 de 2b 10 80 	movl   $0x80102bde,(%esp)
80102d3e:	e8 5f da ff ff       	call   801007a2 <consoleintr>
}
80102d43:	c9                   	leave  
80102d44:	c3                   	ret    
80102d45:	66 90                	xchg   %ax,%ax
80102d47:	90                   	nop

80102d48 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80102d48:	55                   	push   %ebp
80102d49:	89 e5                	mov    %esp,%ebp
80102d4b:	83 ec 08             	sub    $0x8,%esp
80102d4e:	8b 55 08             	mov    0x8(%ebp),%edx
80102d51:	8b 45 0c             	mov    0xc(%ebp),%eax
80102d54:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80102d58:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102d5b:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80102d5f:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80102d63:	ee                   	out    %al,(%dx)
}
80102d64:	c9                   	leave  
80102d65:	c3                   	ret    

80102d66 <readeflags>:
  asm volatile("ltr %0" : : "r" (sel));
}

static inline uint
readeflags(void)
{
80102d66:	55                   	push   %ebp
80102d67:	89 e5                	mov    %esp,%ebp
80102d69:	53                   	push   %ebx
80102d6a:	83 ec 10             	sub    $0x10,%esp
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
80102d6d:	9c                   	pushf  
80102d6e:	5b                   	pop    %ebx
80102d6f:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return eflags;
80102d72:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80102d75:	83 c4 10             	add    $0x10,%esp
80102d78:	5b                   	pop    %ebx
80102d79:	5d                   	pop    %ebp
80102d7a:	c3                   	ret    

80102d7b <lapicw>:

volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
80102d7b:	55                   	push   %ebp
80102d7c:	89 e5                	mov    %esp,%ebp
  lapic[index] = value;
80102d7e:	a1 dc 08 11 80       	mov    0x801108dc,%eax
80102d83:	8b 55 08             	mov    0x8(%ebp),%edx
80102d86:	c1 e2 02             	shl    $0x2,%edx
80102d89:	01 c2                	add    %eax,%edx
80102d8b:	8b 45 0c             	mov    0xc(%ebp),%eax
80102d8e:	89 02                	mov    %eax,(%edx)
  lapic[ID];  // wait for write to finish, by reading
80102d90:	a1 dc 08 11 80       	mov    0x801108dc,%eax
80102d95:	83 c0 20             	add    $0x20,%eax
80102d98:	8b 00                	mov    (%eax),%eax
}
80102d9a:	5d                   	pop    %ebp
80102d9b:	c3                   	ret    

80102d9c <lapicinit>:
//PAGEBREAK!

void
lapicinit(int c)
{
80102d9c:	55                   	push   %ebp
80102d9d:	89 e5                	mov    %esp,%ebp
80102d9f:	83 ec 08             	sub    $0x8,%esp
  if(!lapic) 
80102da2:	a1 dc 08 11 80       	mov    0x801108dc,%eax
80102da7:	85 c0                	test   %eax,%eax
80102da9:	0f 84 47 01 00 00    	je     80102ef6 <lapicinit+0x15a>
    return;

  // Enable local APIC; set spurious interrupt vector.
  lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS));
80102daf:	c7 44 24 04 3f 01 00 	movl   $0x13f,0x4(%esp)
80102db6:	00 
80102db7:	c7 04 24 3c 00 00 00 	movl   $0x3c,(%esp)
80102dbe:	e8 b8 ff ff ff       	call   80102d7b <lapicw>

  // The timer repeatedly counts down at bus frequency
  // from lapic[TICR] and then issues an interrupt.  
  // If xv6 cared more about precise timekeeping,
  // TICR would be calibrated using an external time source.
  lapicw(TDCR, X1);
80102dc3:	c7 44 24 04 0b 00 00 	movl   $0xb,0x4(%esp)
80102dca:	00 
80102dcb:	c7 04 24 f8 00 00 00 	movl   $0xf8,(%esp)
80102dd2:	e8 a4 ff ff ff       	call   80102d7b <lapicw>
  lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER));
80102dd7:	c7 44 24 04 20 00 02 	movl   $0x20020,0x4(%esp)
80102dde:	00 
80102ddf:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
80102de6:	e8 90 ff ff ff       	call   80102d7b <lapicw>
  lapicw(TICR, 10000000); 
80102deb:	c7 44 24 04 80 96 98 	movl   $0x989680,0x4(%esp)
80102df2:	00 
80102df3:	c7 04 24 e0 00 00 00 	movl   $0xe0,(%esp)
80102dfa:	e8 7c ff ff ff       	call   80102d7b <lapicw>

  // Disable logical interrupt lines.
  lapicw(LINT0, MASKED);
80102dff:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80102e06:	00 
80102e07:	c7 04 24 d4 00 00 00 	movl   $0xd4,(%esp)
80102e0e:	e8 68 ff ff ff       	call   80102d7b <lapicw>
  lapicw(LINT1, MASKED);
80102e13:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80102e1a:	00 
80102e1b:	c7 04 24 d8 00 00 00 	movl   $0xd8,(%esp)
80102e22:	e8 54 ff ff ff       	call   80102d7b <lapicw>

  // Disable performance counter overflow interrupts
  // on machines that provide that interrupt entry.
  if(((lapic[VER]>>16) & 0xFF) >= 4)
80102e27:	a1 dc 08 11 80       	mov    0x801108dc,%eax
80102e2c:	83 c0 30             	add    $0x30,%eax
80102e2f:	8b 00                	mov    (%eax),%eax
80102e31:	c1 e8 10             	shr    $0x10,%eax
80102e34:	25 ff 00 00 00       	and    $0xff,%eax
80102e39:	83 f8 03             	cmp    $0x3,%eax
80102e3c:	76 14                	jbe    80102e52 <lapicinit+0xb6>
    lapicw(PCINT, MASKED);
80102e3e:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80102e45:	00 
80102e46:	c7 04 24 d0 00 00 00 	movl   $0xd0,(%esp)
80102e4d:	e8 29 ff ff ff       	call   80102d7b <lapicw>

  // Map error interrupt to IRQ_ERROR.
  lapicw(ERROR, T_IRQ0 + IRQ_ERROR);
80102e52:	c7 44 24 04 33 00 00 	movl   $0x33,0x4(%esp)
80102e59:	00 
80102e5a:	c7 04 24 dc 00 00 00 	movl   $0xdc,(%esp)
80102e61:	e8 15 ff ff ff       	call   80102d7b <lapicw>

  // Clear error status register (requires back-to-back writes).
  lapicw(ESR, 0);
80102e66:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102e6d:	00 
80102e6e:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80102e75:	e8 01 ff ff ff       	call   80102d7b <lapicw>
  lapicw(ESR, 0);
80102e7a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102e81:	00 
80102e82:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80102e89:	e8 ed fe ff ff       	call   80102d7b <lapicw>

  // Ack any outstanding interrupts.
  lapicw(EOI, 0);
80102e8e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102e95:	00 
80102e96:	c7 04 24 2c 00 00 00 	movl   $0x2c,(%esp)
80102e9d:	e8 d9 fe ff ff       	call   80102d7b <lapicw>

  // Send an Init Level De-Assert to synchronise arbitration ID's.
  lapicw(ICRHI, 0);
80102ea2:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102ea9:	00 
80102eaa:	c7 04 24 c4 00 00 00 	movl   $0xc4,(%esp)
80102eb1:	e8 c5 fe ff ff       	call   80102d7b <lapicw>
  lapicw(ICRLO, BCAST | INIT | LEVEL);
80102eb6:	c7 44 24 04 00 85 08 	movl   $0x88500,0x4(%esp)
80102ebd:	00 
80102ebe:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
80102ec5:	e8 b1 fe ff ff       	call   80102d7b <lapicw>
  while(lapic[ICRLO] & DELIVS)
80102eca:	90                   	nop
80102ecb:	a1 dc 08 11 80       	mov    0x801108dc,%eax
80102ed0:	05 00 03 00 00       	add    $0x300,%eax
80102ed5:	8b 00                	mov    (%eax),%eax
80102ed7:	25 00 10 00 00       	and    $0x1000,%eax
80102edc:	85 c0                	test   %eax,%eax
80102ede:	75 eb                	jne    80102ecb <lapicinit+0x12f>
    ;

  // Enable interrupts on the APIC (but not on the processor).
  lapicw(TPR, 0);
80102ee0:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102ee7:	00 
80102ee8:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80102eef:	e8 87 fe ff ff       	call   80102d7b <lapicw>
80102ef4:	eb 01                	jmp    80102ef7 <lapicinit+0x15b>

void
lapicinit(int c)
{
  if(!lapic) 
    return;
80102ef6:	90                   	nop
  while(lapic[ICRLO] & DELIVS)
    ;

  // Enable interrupts on the APIC (but not on the processor).
  lapicw(TPR, 0);
}
80102ef7:	c9                   	leave  
80102ef8:	c3                   	ret    

80102ef9 <cpunum>:

int
cpunum(void)
{
80102ef9:	55                   	push   %ebp
80102efa:	89 e5                	mov    %esp,%ebp
80102efc:	83 ec 18             	sub    $0x18,%esp
  // Cannot call cpu when interrupts are enabled:
  // result not guaranteed to last long enough to be used!
  // Would prefer to panic but even printing is chancy here:
  // almost everything, including cprintf and panic, calls cpu,
  // often indirectly through acquire and release.
  if(readeflags()&FL_IF){
80102eff:	e8 62 fe ff ff       	call   80102d66 <readeflags>
80102f04:	25 00 02 00 00       	and    $0x200,%eax
80102f09:	85 c0                	test   %eax,%eax
80102f0b:	74 29                	je     80102f36 <cpunum+0x3d>
    static int n;
    if(n++ == 0)
80102f0d:	a1 a0 c6 10 80       	mov    0x8010c6a0,%eax
80102f12:	85 c0                	test   %eax,%eax
80102f14:	0f 94 c2             	sete   %dl
80102f17:	83 c0 01             	add    $0x1,%eax
80102f1a:	a3 a0 c6 10 80       	mov    %eax,0x8010c6a0
80102f1f:	84 d2                	test   %dl,%dl
80102f21:	74 13                	je     80102f36 <cpunum+0x3d>
      cprintf("cpu called from %x with interrupts enabled\n",
80102f23:	8b 45 04             	mov    0x4(%ebp),%eax
80102f26:	89 44 24 04          	mov    %eax,0x4(%esp)
80102f2a:	c7 04 24 18 95 10 80 	movl   $0x80109518,(%esp)
80102f31:	e8 60 d4 ff ff       	call   80100396 <cprintf>
        __builtin_return_address(0));
  }

  if(lapic)
80102f36:	a1 dc 08 11 80       	mov    0x801108dc,%eax
80102f3b:	85 c0                	test   %eax,%eax
80102f3d:	74 0f                	je     80102f4e <cpunum+0x55>
    return lapic[ID]>>24;
80102f3f:	a1 dc 08 11 80       	mov    0x801108dc,%eax
80102f44:	83 c0 20             	add    $0x20,%eax
80102f47:	8b 00                	mov    (%eax),%eax
80102f49:	c1 e8 18             	shr    $0x18,%eax
80102f4c:	eb 05                	jmp    80102f53 <cpunum+0x5a>
  return 0;
80102f4e:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102f53:	c9                   	leave  
80102f54:	c3                   	ret    

80102f55 <lapiceoi>:

// Acknowledge interrupt.
void
lapiceoi(void)
{
80102f55:	55                   	push   %ebp
80102f56:	89 e5                	mov    %esp,%ebp
80102f58:	83 ec 08             	sub    $0x8,%esp
  if(lapic)
80102f5b:	a1 dc 08 11 80       	mov    0x801108dc,%eax
80102f60:	85 c0                	test   %eax,%eax
80102f62:	74 14                	je     80102f78 <lapiceoi+0x23>
    lapicw(EOI, 0);
80102f64:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102f6b:	00 
80102f6c:	c7 04 24 2c 00 00 00 	movl   $0x2c,(%esp)
80102f73:	e8 03 fe ff ff       	call   80102d7b <lapicw>
}
80102f78:	c9                   	leave  
80102f79:	c3                   	ret    

80102f7a <microdelay>:

// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80102f7a:	55                   	push   %ebp
80102f7b:	89 e5                	mov    %esp,%ebp
}
80102f7d:	5d                   	pop    %ebp
80102f7e:	c3                   	ret    

80102f7f <lapicstartap>:

// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80102f7f:	55                   	push   %ebp
80102f80:	89 e5                	mov    %esp,%ebp
80102f82:	83 ec 1c             	sub    $0x1c,%esp
80102f85:	8b 45 08             	mov    0x8(%ebp),%eax
80102f88:	88 45 ec             	mov    %al,-0x14(%ebp)
  ushort *wrv;
  
  // "The BSP must initialize CMOS shutdown code to 0AH
  // and the warm reset vector (DWORD based at 40:67) to point at
  // the AP startup code prior to the [universal startup algorithm]."
  outb(IO_RTC, 0xF);  // offset 0xF is shutdown code
80102f8b:	c7 44 24 04 0f 00 00 	movl   $0xf,0x4(%esp)
80102f92:	00 
80102f93:	c7 04 24 70 00 00 00 	movl   $0x70,(%esp)
80102f9a:	e8 a9 fd ff ff       	call   80102d48 <outb>
  outb(IO_RTC+1, 0x0A);
80102f9f:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80102fa6:	00 
80102fa7:	c7 04 24 71 00 00 00 	movl   $0x71,(%esp)
80102fae:	e8 95 fd ff ff       	call   80102d48 <outb>
  wrv = (ushort*)P2V((0x40<<4 | 0x67));  // Warm reset vector
80102fb3:	c7 45 f8 67 04 00 80 	movl   $0x80000467,-0x8(%ebp)
  wrv[0] = 0;
80102fba:	8b 45 f8             	mov    -0x8(%ebp),%eax
80102fbd:	66 c7 00 00 00       	movw   $0x0,(%eax)
  wrv[1] = addr >> 4;
80102fc2:	8b 45 f8             	mov    -0x8(%ebp),%eax
80102fc5:	8d 50 02             	lea    0x2(%eax),%edx
80102fc8:	8b 45 0c             	mov    0xc(%ebp),%eax
80102fcb:	c1 e8 04             	shr    $0x4,%eax
80102fce:	66 89 02             	mov    %ax,(%edx)

  // "Universal startup algorithm."
  // Send INIT (level-triggered) interrupt to reset other CPU.
  lapicw(ICRHI, apicid<<24);
80102fd1:	0f b6 45 ec          	movzbl -0x14(%ebp),%eax
80102fd5:	c1 e0 18             	shl    $0x18,%eax
80102fd8:	89 44 24 04          	mov    %eax,0x4(%esp)
80102fdc:	c7 04 24 c4 00 00 00 	movl   $0xc4,(%esp)
80102fe3:	e8 93 fd ff ff       	call   80102d7b <lapicw>
  lapicw(ICRLO, INIT | LEVEL | ASSERT);
80102fe8:	c7 44 24 04 00 c5 00 	movl   $0xc500,0x4(%esp)
80102fef:	00 
80102ff0:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
80102ff7:	e8 7f fd ff ff       	call   80102d7b <lapicw>
  microdelay(200);
80102ffc:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
80103003:	e8 72 ff ff ff       	call   80102f7a <microdelay>
  lapicw(ICRLO, INIT | LEVEL);
80103008:	c7 44 24 04 00 85 00 	movl   $0x8500,0x4(%esp)
8010300f:	00 
80103010:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
80103017:	e8 5f fd ff ff       	call   80102d7b <lapicw>
  microdelay(100);    // should be 10ms, but too slow in Bochs!
8010301c:	c7 04 24 64 00 00 00 	movl   $0x64,(%esp)
80103023:	e8 52 ff ff ff       	call   80102f7a <microdelay>
  // Send startup IPI (twice!) to enter code.
  // Regular hardware is supposed to only accept a STARTUP
  // when it is in the halted state due to an INIT.  So the second
  // should be ignored, but it is part of the official Intel algorithm.
  // Bochs complains about the second one.  Too bad for Bochs.
  for(i = 0; i < 2; i++){
80103028:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
8010302f:	eb 40                	jmp    80103071 <lapicstartap+0xf2>
    lapicw(ICRHI, apicid<<24);
80103031:	0f b6 45 ec          	movzbl -0x14(%ebp),%eax
80103035:	c1 e0 18             	shl    $0x18,%eax
80103038:	89 44 24 04          	mov    %eax,0x4(%esp)
8010303c:	c7 04 24 c4 00 00 00 	movl   $0xc4,(%esp)
80103043:	e8 33 fd ff ff       	call   80102d7b <lapicw>
    lapicw(ICRLO, STARTUP | (addr>>12));
80103048:	8b 45 0c             	mov    0xc(%ebp),%eax
8010304b:	c1 e8 0c             	shr    $0xc,%eax
8010304e:	80 cc 06             	or     $0x6,%ah
80103051:	89 44 24 04          	mov    %eax,0x4(%esp)
80103055:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
8010305c:	e8 1a fd ff ff       	call   80102d7b <lapicw>
    microdelay(200);
80103061:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
80103068:	e8 0d ff ff ff       	call   80102f7a <microdelay>
  // Send startup IPI (twice!) to enter code.
  // Regular hardware is supposed to only accept a STARTUP
  // when it is in the halted state due to an INIT.  So the second
  // should be ignored, but it is part of the official Intel algorithm.
  // Bochs complains about the second one.  Too bad for Bochs.
  for(i = 0; i < 2; i++){
8010306d:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80103071:	83 7d fc 01          	cmpl   $0x1,-0x4(%ebp)
80103075:	7e ba                	jle    80103031 <lapicstartap+0xb2>
    lapicw(ICRHI, apicid<<24);
    lapicw(ICRLO, STARTUP | (addr>>12));
    microdelay(200);
  }
}
80103077:	c9                   	leave  
80103078:	c3                   	ret    
80103079:	66 90                	xchg   %ax,%ax
8010307b:	90                   	nop

8010307c <initlog>:

static void recover_from_log(void);

void
initlog(void)
{
8010307c:	55                   	push   %ebp
8010307d:	89 e5                	mov    %esp,%ebp
8010307f:	83 ec 28             	sub    $0x28,%esp
  if (sizeof(struct logheader) >= BSIZE)
    panic("initlog: too big logheader");

  struct superblock sb;
  initlock(&log.lock, "log");
80103082:	c7 44 24 04 44 95 10 	movl   $0x80109544,0x4(%esp)
80103089:	80 
8010308a:	c7 04 24 e0 08 11 80 	movl   $0x801108e0,(%esp)
80103091:	e8 50 2b 00 00       	call   80105be6 <initlock>
  readsb(ROOTDEV, &sb);
80103096:	8d 45 e8             	lea    -0x18(%ebp),%eax
80103099:	89 44 24 04          	mov    %eax,0x4(%esp)
8010309d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801030a4:	e8 57 e2 ff ff       	call   80101300 <readsb>
  log.start = sb.size - sb.nlog;
801030a9:	8b 55 e8             	mov    -0x18(%ebp),%edx
801030ac:	8b 45 f4             	mov    -0xc(%ebp),%eax
801030af:	89 d1                	mov    %edx,%ecx
801030b1:	29 c1                	sub    %eax,%ecx
801030b3:	89 c8                	mov    %ecx,%eax
801030b5:	a3 14 09 11 80       	mov    %eax,0x80110914
  log.size = sb.nlog;
801030ba:	8b 45 f4             	mov    -0xc(%ebp),%eax
801030bd:	a3 18 09 11 80       	mov    %eax,0x80110918
  log.dev = ROOTDEV;
801030c2:	c7 05 20 09 11 80 01 	movl   $0x1,0x80110920
801030c9:	00 00 00 
  recover_from_log();
801030cc:	e8 9a 01 00 00       	call   8010326b <recover_from_log>
}
801030d1:	c9                   	leave  
801030d2:	c3                   	ret    

801030d3 <install_trans>:

// Copy committed blocks from log to their home location
static void 
install_trans(void)
{
801030d3:	55                   	push   %ebp
801030d4:	89 e5                	mov    %esp,%ebp
801030d6:	83 ec 28             	sub    $0x28,%esp
  int tail;

  for (tail = 0; tail < log.lh.n; tail++) {
801030d9:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801030e0:	e9 8c 00 00 00       	jmp    80103171 <install_trans+0x9e>
    struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
801030e5:	8b 15 14 09 11 80    	mov    0x80110914,%edx
801030eb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801030ee:	01 d0                	add    %edx,%eax
801030f0:	83 c0 01             	add    $0x1,%eax
801030f3:	89 c2                	mov    %eax,%edx
801030f5:	a1 20 09 11 80       	mov    0x80110920,%eax
801030fa:	89 54 24 04          	mov    %edx,0x4(%esp)
801030fe:	89 04 24             	mov    %eax,(%esp)
80103101:	e8 8b d0 ff ff       	call   80100191 <bread>
80103106:	89 45 f0             	mov    %eax,-0x10(%ebp)
    struct buf *dbuf = bread(log.dev, log.lh.sector[tail]); // read dst
80103109:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010310c:	83 c0 10             	add    $0x10,%eax
8010310f:	8b 04 85 e8 08 11 80 	mov    -0x7feef718(,%eax,4),%eax
80103116:	89 c2                	mov    %eax,%edx
80103118:	a1 20 09 11 80       	mov    0x80110920,%eax
8010311d:	89 54 24 04          	mov    %edx,0x4(%esp)
80103121:	89 04 24             	mov    %eax,(%esp)
80103124:	e8 68 d0 ff ff       	call   80100191 <bread>
80103129:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(dbuf->data, lbuf->data, BSIZE);  // copy block to dst
8010312c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010312f:	8d 50 18             	lea    0x18(%eax),%edx
80103132:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103135:	83 c0 18             	add    $0x18,%eax
80103138:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
8010313f:	00 
80103140:	89 54 24 04          	mov    %edx,0x4(%esp)
80103144:	89 04 24             	mov    %eax,(%esp)
80103147:	e8 e9 2d 00 00       	call   80105f35 <memmove>
    bwrite(dbuf);  // write dst to disk
8010314c:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010314f:	89 04 24             	mov    %eax,(%esp)
80103152:	e8 71 d0 ff ff       	call   801001c8 <bwrite>
    brelse(lbuf); 
80103157:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010315a:	89 04 24             	mov    %eax,(%esp)
8010315d:	e8 a0 d0 ff ff       	call   80100202 <brelse>
    brelse(dbuf);
80103162:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103165:	89 04 24             	mov    %eax,(%esp)
80103168:	e8 95 d0 ff ff       	call   80100202 <brelse>
static void 
install_trans(void)
{
  int tail;

  for (tail = 0; tail < log.lh.n; tail++) {
8010316d:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103171:	a1 24 09 11 80       	mov    0x80110924,%eax
80103176:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103179:	0f 8f 66 ff ff ff    	jg     801030e5 <install_trans+0x12>
    memmove(dbuf->data, lbuf->data, BSIZE);  // copy block to dst
    bwrite(dbuf);  // write dst to disk
    brelse(lbuf); 
    brelse(dbuf);
  }
}
8010317f:	c9                   	leave  
80103180:	c3                   	ret    

80103181 <read_head>:

// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
80103181:	55                   	push   %ebp
80103182:	89 e5                	mov    %esp,%ebp
80103184:	83 ec 28             	sub    $0x28,%esp
  struct buf *buf = bread(log.dev, log.start);
80103187:	a1 14 09 11 80       	mov    0x80110914,%eax
8010318c:	89 c2                	mov    %eax,%edx
8010318e:	a1 20 09 11 80       	mov    0x80110920,%eax
80103193:	89 54 24 04          	mov    %edx,0x4(%esp)
80103197:	89 04 24             	mov    %eax,(%esp)
8010319a:	e8 f2 cf ff ff       	call   80100191 <bread>
8010319f:	89 45 f0             	mov    %eax,-0x10(%ebp)
  struct logheader *lh = (struct logheader *) (buf->data);
801031a2:	8b 45 f0             	mov    -0x10(%ebp),%eax
801031a5:	83 c0 18             	add    $0x18,%eax
801031a8:	89 45 ec             	mov    %eax,-0x14(%ebp)
  int i;
  log.lh.n = lh->n;
801031ab:	8b 45 ec             	mov    -0x14(%ebp),%eax
801031ae:	8b 00                	mov    (%eax),%eax
801031b0:	a3 24 09 11 80       	mov    %eax,0x80110924
  for (i = 0; i < log.lh.n; i++) {
801031b5:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801031bc:	eb 1b                	jmp    801031d9 <read_head+0x58>
    log.lh.sector[i] = lh->sector[i];
801031be:	8b 45 ec             	mov    -0x14(%ebp),%eax
801031c1:	8b 55 f4             	mov    -0xc(%ebp),%edx
801031c4:	8b 44 90 04          	mov    0x4(%eax,%edx,4),%eax
801031c8:	8b 55 f4             	mov    -0xc(%ebp),%edx
801031cb:	83 c2 10             	add    $0x10,%edx
801031ce:	89 04 95 e8 08 11 80 	mov    %eax,-0x7feef718(,%edx,4)
{
  struct buf *buf = bread(log.dev, log.start);
  struct logheader *lh = (struct logheader *) (buf->data);
  int i;
  log.lh.n = lh->n;
  for (i = 0; i < log.lh.n; i++) {
801031d5:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801031d9:	a1 24 09 11 80       	mov    0x80110924,%eax
801031de:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801031e1:	7f db                	jg     801031be <read_head+0x3d>
    log.lh.sector[i] = lh->sector[i];
  }
  brelse(buf);
801031e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801031e6:	89 04 24             	mov    %eax,(%esp)
801031e9:	e8 14 d0 ff ff       	call   80100202 <brelse>
}
801031ee:	c9                   	leave  
801031ef:	c3                   	ret    

801031f0 <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
801031f0:	55                   	push   %ebp
801031f1:	89 e5                	mov    %esp,%ebp
801031f3:	83 ec 28             	sub    $0x28,%esp
  struct buf *buf = bread(log.dev, log.start);
801031f6:	a1 14 09 11 80       	mov    0x80110914,%eax
801031fb:	89 c2                	mov    %eax,%edx
801031fd:	a1 20 09 11 80       	mov    0x80110920,%eax
80103202:	89 54 24 04          	mov    %edx,0x4(%esp)
80103206:	89 04 24             	mov    %eax,(%esp)
80103209:	e8 83 cf ff ff       	call   80100191 <bread>
8010320e:	89 45 f0             	mov    %eax,-0x10(%ebp)
  struct logheader *hb = (struct logheader *) (buf->data);
80103211:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103214:	83 c0 18             	add    $0x18,%eax
80103217:	89 45 ec             	mov    %eax,-0x14(%ebp)
  int i;
  hb->n = log.lh.n;
8010321a:	8b 15 24 09 11 80    	mov    0x80110924,%edx
80103220:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103223:	89 10                	mov    %edx,(%eax)
  for (i = 0; i < log.lh.n; i++) {
80103225:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010322c:	eb 1b                	jmp    80103249 <write_head+0x59>
    hb->sector[i] = log.lh.sector[i];
8010322e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103231:	83 c0 10             	add    $0x10,%eax
80103234:	8b 0c 85 e8 08 11 80 	mov    -0x7feef718(,%eax,4),%ecx
8010323b:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010323e:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103241:	89 4c 90 04          	mov    %ecx,0x4(%eax,%edx,4)
{
  struct buf *buf = bread(log.dev, log.start);
  struct logheader *hb = (struct logheader *) (buf->data);
  int i;
  hb->n = log.lh.n;
  for (i = 0; i < log.lh.n; i++) {
80103245:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103249:	a1 24 09 11 80       	mov    0x80110924,%eax
8010324e:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103251:	7f db                	jg     8010322e <write_head+0x3e>
    hb->sector[i] = log.lh.sector[i];
  }
  bwrite(buf);
80103253:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103256:	89 04 24             	mov    %eax,(%esp)
80103259:	e8 6a cf ff ff       	call   801001c8 <bwrite>
  brelse(buf);
8010325e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103261:	89 04 24             	mov    %eax,(%esp)
80103264:	e8 99 cf ff ff       	call   80100202 <brelse>
}
80103269:	c9                   	leave  
8010326a:	c3                   	ret    

8010326b <recover_from_log>:

static void
recover_from_log(void)
{
8010326b:	55                   	push   %ebp
8010326c:	89 e5                	mov    %esp,%ebp
8010326e:	83 ec 08             	sub    $0x8,%esp
  read_head();      
80103271:	e8 0b ff ff ff       	call   80103181 <read_head>
  install_trans(); // if committed, copy from log to disk
80103276:	e8 58 fe ff ff       	call   801030d3 <install_trans>
  log.lh.n = 0;
8010327b:	c7 05 24 09 11 80 00 	movl   $0x0,0x80110924
80103282:	00 00 00 
  write_head(); // clear the log
80103285:	e8 66 ff ff ff       	call   801031f0 <write_head>
}
8010328a:	c9                   	leave  
8010328b:	c3                   	ret    

8010328c <begin_trans>:

void
begin_trans(void)
{
8010328c:	55                   	push   %ebp
8010328d:	89 e5                	mov    %esp,%ebp
8010328f:	83 ec 18             	sub    $0x18,%esp
  acquire(&log.lock);
80103292:	c7 04 24 e0 08 11 80 	movl   $0x801108e0,(%esp)
80103299:	e8 69 29 00 00       	call   80105c07 <acquire>
  while (log.busy) {
8010329e:	eb 14                	jmp    801032b4 <begin_trans+0x28>
    sleep(&log, &log.lock);
801032a0:	c7 44 24 04 e0 08 11 	movl   $0x801108e0,0x4(%esp)
801032a7:	80 
801032a8:	c7 04 24 e0 08 11 80 	movl   $0x801108e0,(%esp)
801032af:	e8 1d 17 00 00       	call   801049d1 <sleep>

void
begin_trans(void)
{
  acquire(&log.lock);
  while (log.busy) {
801032b4:	a1 1c 09 11 80       	mov    0x8011091c,%eax
801032b9:	85 c0                	test   %eax,%eax
801032bb:	75 e3                	jne    801032a0 <begin_trans+0x14>
    sleep(&log, &log.lock);
  }
  log.busy = 1;
801032bd:	c7 05 1c 09 11 80 01 	movl   $0x1,0x8011091c
801032c4:	00 00 00 
  release(&log.lock);
801032c7:	c7 04 24 e0 08 11 80 	movl   $0x801108e0,(%esp)
801032ce:	e8 96 29 00 00       	call   80105c69 <release>
}
801032d3:	c9                   	leave  
801032d4:	c3                   	ret    

801032d5 <commit_trans>:

void
commit_trans(void)
{
801032d5:	55                   	push   %ebp
801032d6:	89 e5                	mov    %esp,%ebp
801032d8:	83 ec 18             	sub    $0x18,%esp
  if (log.lh.n > 0) {
801032db:	a1 24 09 11 80       	mov    0x80110924,%eax
801032e0:	85 c0                	test   %eax,%eax
801032e2:	7e 19                	jle    801032fd <commit_trans+0x28>
    write_head();    // Write header to disk -- the real commit
801032e4:	e8 07 ff ff ff       	call   801031f0 <write_head>
    install_trans(); // Now install writes to home locations
801032e9:	e8 e5 fd ff ff       	call   801030d3 <install_trans>
    log.lh.n = 0; 
801032ee:	c7 05 24 09 11 80 00 	movl   $0x0,0x80110924
801032f5:	00 00 00 
    write_head();    // Erase the transaction from the log
801032f8:	e8 f3 fe ff ff       	call   801031f0 <write_head>
  }
  
  acquire(&log.lock);
801032fd:	c7 04 24 e0 08 11 80 	movl   $0x801108e0,(%esp)
80103304:	e8 fe 28 00 00       	call   80105c07 <acquire>
  log.busy = 0;
80103309:	c7 05 1c 09 11 80 00 	movl   $0x0,0x8011091c
80103310:	00 00 00 
  wakeup(&log);
80103313:	c7 04 24 e0 08 11 80 	movl   $0x801108e0,(%esp)
8010331a:	e8 f6 17 00 00       	call   80104b15 <wakeup>
  release(&log.lock);
8010331f:	c7 04 24 e0 08 11 80 	movl   $0x801108e0,(%esp)
80103326:	e8 3e 29 00 00       	call   80105c69 <release>
}
8010332b:	c9                   	leave  
8010332c:	c3                   	ret    

8010332d <log_write>:
//   modify bp->data[]
//   log_write(bp)
//   brelse(bp)
void
log_write(struct buf *b)
{
8010332d:	55                   	push   %ebp
8010332e:	89 e5                	mov    %esp,%ebp
80103330:	83 ec 28             	sub    $0x28,%esp
  int i;

  if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80103333:	a1 24 09 11 80       	mov    0x80110924,%eax
80103338:	83 f8 09             	cmp    $0x9,%eax
8010333b:	7f 12                	jg     8010334f <log_write+0x22>
8010333d:	a1 24 09 11 80       	mov    0x80110924,%eax
80103342:	8b 15 18 09 11 80    	mov    0x80110918,%edx
80103348:	83 ea 01             	sub    $0x1,%edx
8010334b:	39 d0                	cmp    %edx,%eax
8010334d:	7c 0c                	jl     8010335b <log_write+0x2e>
    panic("too big a transaction");
8010334f:	c7 04 24 48 95 10 80 	movl   $0x80109548,(%esp)
80103356:	e8 d7 d1 ff ff       	call   80100532 <panic>
  if (!log.busy)
8010335b:	a1 1c 09 11 80       	mov    0x8011091c,%eax
80103360:	85 c0                	test   %eax,%eax
80103362:	75 0c                	jne    80103370 <log_write+0x43>
    panic("write outside of trans");
80103364:	c7 04 24 5e 95 10 80 	movl   $0x8010955e,(%esp)
8010336b:	e8 c2 d1 ff ff       	call   80100532 <panic>

  for (i = 0; i < log.lh.n; i++) {
80103370:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80103377:	eb 1d                	jmp    80103396 <log_write+0x69>
    if (log.lh.sector[i] == b->sector)   // log absorbtion?
80103379:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010337c:	83 c0 10             	add    $0x10,%eax
8010337f:	8b 04 85 e8 08 11 80 	mov    -0x7feef718(,%eax,4),%eax
80103386:	89 c2                	mov    %eax,%edx
80103388:	8b 45 08             	mov    0x8(%ebp),%eax
8010338b:	8b 40 08             	mov    0x8(%eax),%eax
8010338e:	39 c2                	cmp    %eax,%edx
80103390:	74 10                	je     801033a2 <log_write+0x75>
  if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
    panic("too big a transaction");
  if (!log.busy)
    panic("write outside of trans");

  for (i = 0; i < log.lh.n; i++) {
80103392:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103396:	a1 24 09 11 80       	mov    0x80110924,%eax
8010339b:	3b 45 f4             	cmp    -0xc(%ebp),%eax
8010339e:	7f d9                	jg     80103379 <log_write+0x4c>
801033a0:	eb 01                	jmp    801033a3 <log_write+0x76>
    if (log.lh.sector[i] == b->sector)   // log absorbtion?
      break;
801033a2:	90                   	nop
  }
  log.lh.sector[i] = b->sector;
801033a3:	8b 45 08             	mov    0x8(%ebp),%eax
801033a6:	8b 40 08             	mov    0x8(%eax),%eax
801033a9:	8b 55 f4             	mov    -0xc(%ebp),%edx
801033ac:	83 c2 10             	add    $0x10,%edx
801033af:	89 04 95 e8 08 11 80 	mov    %eax,-0x7feef718(,%edx,4)
  struct buf *lbuf = bread(b->dev, log.start+i+1);
801033b6:	8b 15 14 09 11 80    	mov    0x80110914,%edx
801033bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801033bf:	01 d0                	add    %edx,%eax
801033c1:	83 c0 01             	add    $0x1,%eax
801033c4:	89 c2                	mov    %eax,%edx
801033c6:	8b 45 08             	mov    0x8(%ebp),%eax
801033c9:	8b 40 04             	mov    0x4(%eax),%eax
801033cc:	89 54 24 04          	mov    %edx,0x4(%esp)
801033d0:	89 04 24             	mov    %eax,(%esp)
801033d3:	e8 b9 cd ff ff       	call   80100191 <bread>
801033d8:	89 45 f0             	mov    %eax,-0x10(%ebp)
  memmove(lbuf->data, b->data, BSIZE);
801033db:	8b 45 08             	mov    0x8(%ebp),%eax
801033de:	8d 50 18             	lea    0x18(%eax),%edx
801033e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801033e4:	83 c0 18             	add    $0x18,%eax
801033e7:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
801033ee:	00 
801033ef:	89 54 24 04          	mov    %edx,0x4(%esp)
801033f3:	89 04 24             	mov    %eax,(%esp)
801033f6:	e8 3a 2b 00 00       	call   80105f35 <memmove>
  bwrite(lbuf);
801033fb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801033fe:	89 04 24             	mov    %eax,(%esp)
80103401:	e8 c2 cd ff ff       	call   801001c8 <bwrite>
  brelse(lbuf);
80103406:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103409:	89 04 24             	mov    %eax,(%esp)
8010340c:	e8 f1 cd ff ff       	call   80100202 <brelse>
  if (i == log.lh.n)
80103411:	a1 24 09 11 80       	mov    0x80110924,%eax
80103416:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103419:	75 0d                	jne    80103428 <log_write+0xfb>
    log.lh.n++;
8010341b:	a1 24 09 11 80       	mov    0x80110924,%eax
80103420:	83 c0 01             	add    $0x1,%eax
80103423:	a3 24 09 11 80       	mov    %eax,0x80110924
  b->flags |= B_DIRTY; // XXX prevent eviction
80103428:	8b 45 08             	mov    0x8(%ebp),%eax
8010342b:	8b 00                	mov    (%eax),%eax
8010342d:	89 c2                	mov    %eax,%edx
8010342f:	83 ca 04             	or     $0x4,%edx
80103432:	8b 45 08             	mov    0x8(%ebp),%eax
80103435:	89 10                	mov    %edx,(%eax)
}
80103437:	c9                   	leave  
80103438:	c3                   	ret    
80103439:	66 90                	xchg   %ax,%ax
8010343b:	90                   	nop

8010343c <v2p>:
8010343c:	55                   	push   %ebp
8010343d:	89 e5                	mov    %esp,%ebp
8010343f:	8b 45 08             	mov    0x8(%ebp),%eax
80103442:	05 00 00 00 80       	add    $0x80000000,%eax
80103447:	5d                   	pop    %ebp
80103448:	c3                   	ret    

80103449 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
80103449:	55                   	push   %ebp
8010344a:	89 e5                	mov    %esp,%ebp
8010344c:	8b 45 08             	mov    0x8(%ebp),%eax
8010344f:	05 00 00 00 80       	add    $0x80000000,%eax
80103454:	5d                   	pop    %ebp
80103455:	c3                   	ret    

80103456 <xchg>:
  asm volatile("sti");
}

static inline uint
xchg(volatile uint *addr, uint newval)
{
80103456:	55                   	push   %ebp
80103457:	89 e5                	mov    %esp,%ebp
80103459:	53                   	push   %ebx
8010345a:	83 ec 10             	sub    $0x10,%esp
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
               "+m" (*addr), "=a" (result) :
8010345d:	8b 55 08             	mov    0x8(%ebp),%edx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80103460:	8b 45 0c             	mov    0xc(%ebp),%eax
               "+m" (*addr), "=a" (result) :
80103463:	8b 4d 08             	mov    0x8(%ebp),%ecx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80103466:	89 c3                	mov    %eax,%ebx
80103468:	89 d8                	mov    %ebx,%eax
8010346a:	f0 87 02             	lock xchg %eax,(%edx)
8010346d:	89 c3                	mov    %eax,%ebx
8010346f:	89 5d f8             	mov    %ebx,-0x8(%ebp)
               "+m" (*addr), "=a" (result) :
               "1" (newval) :
               "cc");
  return result;
80103472:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80103475:	83 c4 10             	add    $0x10,%esp
80103478:	5b                   	pop    %ebx
80103479:	5d                   	pop    %ebp
8010347a:	c3                   	ret    

8010347b <main>:
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
8010347b:	55                   	push   %ebp
8010347c:	89 e5                	mov    %esp,%ebp
8010347e:	83 e4 f0             	and    $0xfffffff0,%esp
80103481:	83 ec 10             	sub    $0x10,%esp
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
80103484:	c7 44 24 04 00 00 40 	movl   $0x80400000,0x4(%esp)
8010348b:	80 
8010348c:	c7 04 24 9c 7a 11 80 	movl   $0x80117a9c,(%esp)
80103493:	e8 45 f5 ff ff       	call   801029dd <kinit1>
  kvmalloc();      // kernel page table
80103498:	e8 eb 56 00 00       	call   80108b88 <kvmalloc>
  mpinit();        // collect info about this machine
8010349d:	e8 7b 04 00 00       	call   8010391d <mpinit>
  lapicinit(mpbcpu());
801034a2:	e8 42 02 00 00       	call   801036e9 <mpbcpu>
801034a7:	89 04 24             	mov    %eax,(%esp)
801034aa:	e8 ed f8 ff ff       	call   80102d9c <lapicinit>
  seginit();       // set up segments
801034af:	e8 69 50 00 00       	call   8010851d <seginit>
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
801034b4:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801034ba:	0f b6 00             	movzbl (%eax),%eax
801034bd:	0f b6 c0             	movzbl %al,%eax
801034c0:	89 44 24 04          	mov    %eax,0x4(%esp)
801034c4:	c7 04 24 75 95 10 80 	movl   $0x80109575,(%esp)
801034cb:	e8 c6 ce ff ff       	call   80100396 <cprintf>
  picinit();       // interrupt controller
801034d0:	e8 ad 06 00 00       	call   80103b82 <picinit>
  ioapicinit();    // another interrupt controller
801034d5:	e8 f3 f3 ff ff       	call   801028cd <ioapicinit>
  consoleinit();   // I/O devices & their interrupts
801034da:	e8 a5 d5 ff ff       	call   80100a84 <consoleinit>
  uartinit();      // serial port
801034df:	e8 84 43 00 00       	call   80107868 <uartinit>
  pinit();         // process table
801034e4:	e8 cc 0b 00 00       	call   801040b5 <pinit>
  tvinit();        // trap vectors
801034e9:	e8 1d 3f 00 00       	call   8010740b <tvinit>
  binit();         // buffer cache
801034ee:	e8 41 cb ff ff       	call   80100034 <binit>
  fileinit();      // file table
801034f3:	e8 1c da ff ff       	call   80100f14 <fileinit>
  iinit();         // inode cache
801034f8:	e8 cc e0 ff ff       	call   801015c9 <iinit>
  ideinit();       // disk
801034fd:	e8 4e f0 ff ff       	call   80102550 <ideinit>
  if(!ismp)
80103502:	a1 64 09 11 80       	mov    0x80110964,%eax
80103507:	85 c0                	test   %eax,%eax
80103509:	75 05                	jne    80103510 <main+0x95>
    timerinit();   // uniprocessor timer
8010350b:	e8 3e 3e 00 00       	call   8010734e <timerinit>
  startothers();   // start other processors
80103510:	e8 9b 00 00 00       	call   801035b0 <startothers>
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
80103515:	c7 44 24 04 00 00 00 	movl   $0x8e000000,0x4(%esp)
8010351c:	8e 
8010351d:	c7 04 24 00 00 40 80 	movl   $0x80400000,(%esp)
80103524:	e8 ec f4 ff ff       	call   80102a15 <kinit2>
  userinit();      // first user process
80103529:	e8 a5 0c 00 00       	call   801041d3 <userinit>
  // Finish setting up this processor in mpmain.
  mpmain();
8010352e:	e8 22 00 00 00       	call   80103555 <mpmain>

80103533 <mpenter>:
}

// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80103533:	55                   	push   %ebp
80103534:	89 e5                	mov    %esp,%ebp
80103536:	83 ec 18             	sub    $0x18,%esp
  switchkvm(); 
80103539:	e8 61 56 00 00       	call   80108b9f <switchkvm>
  seginit();
8010353e:	e8 da 4f 00 00       	call   8010851d <seginit>
  lapicinit(cpunum());
80103543:	e8 b1 f9 ff ff       	call   80102ef9 <cpunum>
80103548:	89 04 24             	mov    %eax,(%esp)
8010354b:	e8 4c f8 ff ff       	call   80102d9c <lapicinit>
  mpmain();
80103550:	e8 00 00 00 00       	call   80103555 <mpmain>

80103555 <mpmain>:
}

// Common CPU setup code.
static void
mpmain(void)
{
80103555:	55                   	push   %ebp
80103556:	89 e5                	mov    %esp,%ebp
80103558:	83 ec 18             	sub    $0x18,%esp
  cprintf("cpu%d: starting\n", cpu->id);
8010355b:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80103561:	0f b6 00             	movzbl (%eax),%eax
80103564:	0f b6 c0             	movzbl %al,%eax
80103567:	89 44 24 04          	mov    %eax,0x4(%esp)
8010356b:	c7 04 24 8c 95 10 80 	movl   $0x8010958c,(%esp)
80103572:	e8 1f ce ff ff       	call   80100396 <cprintf>
  idtinit();       // load idt register
80103577:	e8 03 40 00 00       	call   8010757f <idtinit>
  xchg(&cpu->started, 1); // tell startothers() we're up
8010357c:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80103582:	05 a8 00 00 00       	add    $0xa8,%eax
80103587:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
8010358e:	00 
8010358f:	89 04 24             	mov    %eax,(%esp)
80103592:	e8 bf fe ff ff       	call   80103456 <xchg>
  createInternalProcess("inSwapper",&inSwapper);
80103597:	c7 44 24 04 71 4e 10 	movl   $0x80104e71,0x4(%esp)
8010359e:	80 
8010359f:	c7 04 24 9d 95 10 80 	movl   $0x8010959d,(%esp)
801035a6:	e8 0c 17 00 00       	call   80104cb7 <createInternalProcess>
  scheduler();     // start running processes
801035ab:	e8 23 12 00 00       	call   801047d3 <scheduler>

801035b0 <startothers>:
pde_t entrypgdir[];  // For entry.S

// Start the non-boot (AP) processors.
static void
startothers(void)
{
801035b0:	55                   	push   %ebp
801035b1:	89 e5                	mov    %esp,%ebp
801035b3:	53                   	push   %ebx
801035b4:	83 ec 24             	sub    $0x24,%esp
  char *stack;

  // Write entry code to unused memory at 0x7000.
  // The linker has placed the image of entryother.S in
  // _binary_entryother_start.
  code = p2v(0x7000);
801035b7:	c7 04 24 00 70 00 00 	movl   $0x7000,(%esp)
801035be:	e8 86 fe ff ff       	call   80103449 <p2v>
801035c3:	89 45 f0             	mov    %eax,-0x10(%ebp)
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
801035c6:	b8 8a 00 00 00       	mov    $0x8a,%eax
801035cb:	89 44 24 08          	mov    %eax,0x8(%esp)
801035cf:	c7 44 24 04 6c c5 10 	movl   $0x8010c56c,0x4(%esp)
801035d6:	80 
801035d7:	8b 45 f0             	mov    -0x10(%ebp),%eax
801035da:	89 04 24             	mov    %eax,(%esp)
801035dd:	e8 53 29 00 00       	call   80105f35 <memmove>

  for(c = cpus; c < cpus+ncpu; c++){
801035e2:	c7 45 f4 80 09 11 80 	movl   $0x80110980,-0xc(%ebp)
801035e9:	e9 86 00 00 00       	jmp    80103674 <startothers+0xc4>
    if(c == cpus+cpunum())  // We've started already.
801035ee:	e8 06 f9 ff ff       	call   80102ef9 <cpunum>
801035f3:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
801035f9:	05 80 09 11 80       	add    $0x80110980,%eax
801035fe:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103601:	74 69                	je     8010366c <startothers+0xbc>
      continue;

    // Tell entryother.S what stack to use, where to enter, and what 
    // pgdir to use. We cannot use kpgdir yet, because the AP processor
    // is running in low  memory, so we use entrypgdir for the APs too.
    stack = kalloc();
80103603:	e8 5e f5 ff ff       	call   80102b66 <kalloc>
80103608:	89 45 ec             	mov    %eax,-0x14(%ebp)
    *(void**)(code-4) = stack + KSTACKSIZE;
8010360b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010360e:	83 e8 04             	sub    $0x4,%eax
80103611:	8b 55 ec             	mov    -0x14(%ebp),%edx
80103614:	81 c2 00 10 00 00    	add    $0x1000,%edx
8010361a:	89 10                	mov    %edx,(%eax)
    *(void**)(code-8) = mpenter;
8010361c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010361f:	83 e8 08             	sub    $0x8,%eax
80103622:	c7 00 33 35 10 80    	movl   $0x80103533,(%eax)
    *(int**)(code-12) = (void *) v2p(entrypgdir);
80103628:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010362b:	8d 58 f4             	lea    -0xc(%eax),%ebx
8010362e:	c7 04 24 00 b0 10 80 	movl   $0x8010b000,(%esp)
80103635:	e8 02 fe ff ff       	call   8010343c <v2p>
8010363a:	89 03                	mov    %eax,(%ebx)

    lapicstartap(c->id, v2p(code));
8010363c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010363f:	89 04 24             	mov    %eax,(%esp)
80103642:	e8 f5 fd ff ff       	call   8010343c <v2p>
80103647:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010364a:	0f b6 12             	movzbl (%edx),%edx
8010364d:	0f b6 d2             	movzbl %dl,%edx
80103650:	89 44 24 04          	mov    %eax,0x4(%esp)
80103654:	89 14 24             	mov    %edx,(%esp)
80103657:	e8 23 f9 ff ff       	call   80102f7f <lapicstartap>

    // wait for cpu to finish mpmain()
    while(c->started == 0)
8010365c:	90                   	nop
8010365d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103660:	8b 80 a8 00 00 00    	mov    0xa8(%eax),%eax
80103666:	85 c0                	test   %eax,%eax
80103668:	74 f3                	je     8010365d <startothers+0xad>
8010366a:	eb 01                	jmp    8010366d <startothers+0xbd>
  code = p2v(0x7000);
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);

  for(c = cpus; c < cpus+ncpu; c++){
    if(c == cpus+cpunum())  // We've started already.
      continue;
8010366c:	90                   	nop
  // The linker has placed the image of entryother.S in
  // _binary_entryother_start.
  code = p2v(0x7000);
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);

  for(c = cpus; c < cpus+ncpu; c++){
8010366d:	81 45 f4 bc 00 00 00 	addl   $0xbc,-0xc(%ebp)
80103674:	a1 60 0f 11 80       	mov    0x80110f60,%eax
80103679:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
8010367f:	05 80 09 11 80       	add    $0x80110980,%eax
80103684:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103687:	0f 87 61 ff ff ff    	ja     801035ee <startothers+0x3e>

    // wait for cpu to finish mpmain()
    while(c->started == 0)
      ;
  }
}
8010368d:	83 c4 24             	add    $0x24,%esp
80103690:	5b                   	pop    %ebx
80103691:	5d                   	pop    %ebp
80103692:	c3                   	ret    
80103693:	90                   	nop

80103694 <p2v>:
80103694:	55                   	push   %ebp
80103695:	89 e5                	mov    %esp,%ebp
80103697:	8b 45 08             	mov    0x8(%ebp),%eax
8010369a:	05 00 00 00 80       	add    $0x80000000,%eax
8010369f:	5d                   	pop    %ebp
801036a0:	c3                   	ret    

801036a1 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
801036a1:	55                   	push   %ebp
801036a2:	89 e5                	mov    %esp,%ebp
801036a4:	53                   	push   %ebx
801036a5:	83 ec 14             	sub    $0x14,%esp
801036a8:	8b 45 08             	mov    0x8(%ebp),%eax
801036ab:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801036af:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
801036b3:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
801036b7:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
801036bb:	ec                   	in     (%dx),%al
801036bc:	89 c3                	mov    %eax,%ebx
801036be:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
801036c1:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
801036c5:	83 c4 14             	add    $0x14,%esp
801036c8:	5b                   	pop    %ebx
801036c9:	5d                   	pop    %ebp
801036ca:	c3                   	ret    

801036cb <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
801036cb:	55                   	push   %ebp
801036cc:	89 e5                	mov    %esp,%ebp
801036ce:	83 ec 08             	sub    $0x8,%esp
801036d1:	8b 55 08             	mov    0x8(%ebp),%edx
801036d4:	8b 45 0c             	mov    0xc(%ebp),%eax
801036d7:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
801036db:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
801036de:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
801036e2:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
801036e6:	ee                   	out    %al,(%dx)
}
801036e7:	c9                   	leave  
801036e8:	c3                   	ret    

801036e9 <mpbcpu>:
int ncpu;
uchar ioapicid;

int
mpbcpu(void)
{
801036e9:	55                   	push   %ebp
801036ea:	89 e5                	mov    %esp,%ebp
  return bcpu-cpus;
801036ec:	a1 a4 c6 10 80       	mov    0x8010c6a4,%eax
801036f1:	89 c2                	mov    %eax,%edx
801036f3:	b8 80 09 11 80       	mov    $0x80110980,%eax
801036f8:	89 d1                	mov    %edx,%ecx
801036fa:	29 c1                	sub    %eax,%ecx
801036fc:	89 c8                	mov    %ecx,%eax
801036fe:	c1 f8 02             	sar    $0x2,%eax
80103701:	69 c0 cf 46 7d 67    	imul   $0x677d46cf,%eax,%eax
}
80103707:	5d                   	pop    %ebp
80103708:	c3                   	ret    

80103709 <sum>:

static uchar
sum(uchar *addr, int len)
{
80103709:	55                   	push   %ebp
8010370a:	89 e5                	mov    %esp,%ebp
8010370c:	83 ec 10             	sub    $0x10,%esp
  int i, sum;
  
  sum = 0;
8010370f:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
  for(i=0; i<len; i++)
80103716:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
8010371d:	eb 15                	jmp    80103734 <sum+0x2b>
    sum += addr[i];
8010371f:	8b 55 fc             	mov    -0x4(%ebp),%edx
80103722:	8b 45 08             	mov    0x8(%ebp),%eax
80103725:	01 d0                	add    %edx,%eax
80103727:	0f b6 00             	movzbl (%eax),%eax
8010372a:	0f b6 c0             	movzbl %al,%eax
8010372d:	01 45 f8             	add    %eax,-0x8(%ebp)
sum(uchar *addr, int len)
{
  int i, sum;
  
  sum = 0;
  for(i=0; i<len; i++)
80103730:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80103734:	8b 45 fc             	mov    -0x4(%ebp),%eax
80103737:	3b 45 0c             	cmp    0xc(%ebp),%eax
8010373a:	7c e3                	jl     8010371f <sum+0x16>
    sum += addr[i];
  return sum;
8010373c:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
8010373f:	c9                   	leave  
80103740:	c3                   	ret    

80103741 <mpsearch1>:

// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80103741:	55                   	push   %ebp
80103742:	89 e5                	mov    %esp,%ebp
80103744:	83 ec 28             	sub    $0x28,%esp
  uchar *e, *p, *addr;

  addr = p2v(a);
80103747:	8b 45 08             	mov    0x8(%ebp),%eax
8010374a:	89 04 24             	mov    %eax,(%esp)
8010374d:	e8 42 ff ff ff       	call   80103694 <p2v>
80103752:	89 45 f0             	mov    %eax,-0x10(%ebp)
  e = addr+len;
80103755:	8b 55 0c             	mov    0xc(%ebp),%edx
80103758:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010375b:	01 d0                	add    %edx,%eax
8010375d:	89 45 ec             	mov    %eax,-0x14(%ebp)
  for(p = addr; p < e; p += sizeof(struct mp))
80103760:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103763:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103766:	eb 3f                	jmp    801037a7 <mpsearch1+0x66>
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103768:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
8010376f:	00 
80103770:	c7 44 24 04 a8 95 10 	movl   $0x801095a8,0x4(%esp)
80103777:	80 
80103778:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010377b:	89 04 24             	mov    %eax,(%esp)
8010377e:	e8 56 27 00 00       	call   80105ed9 <memcmp>
80103783:	85 c0                	test   %eax,%eax
80103785:	75 1c                	jne    801037a3 <mpsearch1+0x62>
80103787:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
8010378e:	00 
8010378f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103792:	89 04 24             	mov    %eax,(%esp)
80103795:	e8 6f ff ff ff       	call   80103709 <sum>
8010379a:	84 c0                	test   %al,%al
8010379c:	75 05                	jne    801037a3 <mpsearch1+0x62>
      return (struct mp*)p;
8010379e:	8b 45 f4             	mov    -0xc(%ebp),%eax
801037a1:	eb 11                	jmp    801037b4 <mpsearch1+0x73>
{
  uchar *e, *p, *addr;

  addr = p2v(a);
  e = addr+len;
  for(p = addr; p < e; p += sizeof(struct mp))
801037a3:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
801037a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801037aa:	3b 45 ec             	cmp    -0x14(%ebp),%eax
801037ad:	72 b9                	jb     80103768 <mpsearch1+0x27>
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
      return (struct mp*)p;
  return 0;
801037af:	b8 00 00 00 00       	mov    $0x0,%eax
}
801037b4:	c9                   	leave  
801037b5:	c3                   	ret    

801037b6 <mpsearch>:
// 1) in the first KB of the EBDA;
// 2) in the last KB of system base memory;
// 3) in the BIOS ROM between 0xE0000 and 0xFFFFF.
static struct mp*
mpsearch(void)
{
801037b6:	55                   	push   %ebp
801037b7:	89 e5                	mov    %esp,%ebp
801037b9:	83 ec 28             	sub    $0x28,%esp
  uchar *bda;
  uint p;
  struct mp *mp;

  bda = (uchar *) P2V(0x400);
801037bc:	c7 45 f4 00 04 00 80 	movl   $0x80000400,-0xc(%ebp)
  if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
801037c3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801037c6:	83 c0 0f             	add    $0xf,%eax
801037c9:	0f b6 00             	movzbl (%eax),%eax
801037cc:	0f b6 c0             	movzbl %al,%eax
801037cf:	89 c2                	mov    %eax,%edx
801037d1:	c1 e2 08             	shl    $0x8,%edx
801037d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801037d7:	83 c0 0e             	add    $0xe,%eax
801037da:	0f b6 00             	movzbl (%eax),%eax
801037dd:	0f b6 c0             	movzbl %al,%eax
801037e0:	09 d0                	or     %edx,%eax
801037e2:	c1 e0 04             	shl    $0x4,%eax
801037e5:	89 45 f0             	mov    %eax,-0x10(%ebp)
801037e8:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801037ec:	74 21                	je     8010380f <mpsearch+0x59>
    if((mp = mpsearch1(p, 1024)))
801037ee:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
801037f5:	00 
801037f6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801037f9:	89 04 24             	mov    %eax,(%esp)
801037fc:	e8 40 ff ff ff       	call   80103741 <mpsearch1>
80103801:	89 45 ec             	mov    %eax,-0x14(%ebp)
80103804:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80103808:	74 50                	je     8010385a <mpsearch+0xa4>
      return mp;
8010380a:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010380d:	eb 5f                	jmp    8010386e <mpsearch+0xb8>
  } else {
    p = ((bda[0x14]<<8)|bda[0x13])*1024;
8010380f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103812:	83 c0 14             	add    $0x14,%eax
80103815:	0f b6 00             	movzbl (%eax),%eax
80103818:	0f b6 c0             	movzbl %al,%eax
8010381b:	89 c2                	mov    %eax,%edx
8010381d:	c1 e2 08             	shl    $0x8,%edx
80103820:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103823:	83 c0 13             	add    $0x13,%eax
80103826:	0f b6 00             	movzbl (%eax),%eax
80103829:	0f b6 c0             	movzbl %al,%eax
8010382c:	09 d0                	or     %edx,%eax
8010382e:	c1 e0 0a             	shl    $0xa,%eax
80103831:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if((mp = mpsearch1(p-1024, 1024)))
80103834:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103837:	2d 00 04 00 00       	sub    $0x400,%eax
8010383c:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
80103843:	00 
80103844:	89 04 24             	mov    %eax,(%esp)
80103847:	e8 f5 fe ff ff       	call   80103741 <mpsearch1>
8010384c:	89 45 ec             	mov    %eax,-0x14(%ebp)
8010384f:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80103853:	74 05                	je     8010385a <mpsearch+0xa4>
      return mp;
80103855:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103858:	eb 14                	jmp    8010386e <mpsearch+0xb8>
  }
  return mpsearch1(0xF0000, 0x10000);
8010385a:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80103861:	00 
80103862:	c7 04 24 00 00 0f 00 	movl   $0xf0000,(%esp)
80103869:	e8 d3 fe ff ff       	call   80103741 <mpsearch1>
}
8010386e:	c9                   	leave  
8010386f:	c3                   	ret    

80103870 <mpconfig>:
// Check for correct signature, calculate the checksum and,
// if correct, check the version.
// To do: check extended table checksum.
static struct mpconf*
mpconfig(struct mp **pmp)
{
80103870:	55                   	push   %ebp
80103871:	89 e5                	mov    %esp,%ebp
80103873:	83 ec 28             	sub    $0x28,%esp
  struct mpconf *conf;
  struct mp *mp;

  if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103876:	e8 3b ff ff ff       	call   801037b6 <mpsearch>
8010387b:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010387e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103882:	74 0a                	je     8010388e <mpconfig+0x1e>
80103884:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103887:	8b 40 04             	mov    0x4(%eax),%eax
8010388a:	85 c0                	test   %eax,%eax
8010388c:	75 0a                	jne    80103898 <mpconfig+0x28>
    return 0;
8010388e:	b8 00 00 00 00       	mov    $0x0,%eax
80103893:	e9 83 00 00 00       	jmp    8010391b <mpconfig+0xab>
  conf = (struct mpconf*) p2v((uint) mp->physaddr);
80103898:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010389b:	8b 40 04             	mov    0x4(%eax),%eax
8010389e:	89 04 24             	mov    %eax,(%esp)
801038a1:	e8 ee fd ff ff       	call   80103694 <p2v>
801038a6:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(memcmp(conf, "PCMP", 4) != 0)
801038a9:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
801038b0:	00 
801038b1:	c7 44 24 04 ad 95 10 	movl   $0x801095ad,0x4(%esp)
801038b8:	80 
801038b9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038bc:	89 04 24             	mov    %eax,(%esp)
801038bf:	e8 15 26 00 00       	call   80105ed9 <memcmp>
801038c4:	85 c0                	test   %eax,%eax
801038c6:	74 07                	je     801038cf <mpconfig+0x5f>
    return 0;
801038c8:	b8 00 00 00 00       	mov    $0x0,%eax
801038cd:	eb 4c                	jmp    8010391b <mpconfig+0xab>
  if(conf->version != 1 && conf->version != 4)
801038cf:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038d2:	0f b6 40 06          	movzbl 0x6(%eax),%eax
801038d6:	3c 01                	cmp    $0x1,%al
801038d8:	74 12                	je     801038ec <mpconfig+0x7c>
801038da:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038dd:	0f b6 40 06          	movzbl 0x6(%eax),%eax
801038e1:	3c 04                	cmp    $0x4,%al
801038e3:	74 07                	je     801038ec <mpconfig+0x7c>
    return 0;
801038e5:	b8 00 00 00 00       	mov    $0x0,%eax
801038ea:	eb 2f                	jmp    8010391b <mpconfig+0xab>
  if(sum((uchar*)conf, conf->length) != 0)
801038ec:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038ef:	0f b7 40 04          	movzwl 0x4(%eax),%eax
801038f3:	0f b7 c0             	movzwl %ax,%eax
801038f6:	89 44 24 04          	mov    %eax,0x4(%esp)
801038fa:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038fd:	89 04 24             	mov    %eax,(%esp)
80103900:	e8 04 fe ff ff       	call   80103709 <sum>
80103905:	84 c0                	test   %al,%al
80103907:	74 07                	je     80103910 <mpconfig+0xa0>
    return 0;
80103909:	b8 00 00 00 00       	mov    $0x0,%eax
8010390e:	eb 0b                	jmp    8010391b <mpconfig+0xab>
  *pmp = mp;
80103910:	8b 45 08             	mov    0x8(%ebp),%eax
80103913:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103916:	89 10                	mov    %edx,(%eax)
  return conf;
80103918:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
8010391b:	c9                   	leave  
8010391c:	c3                   	ret    

8010391d <mpinit>:

void
mpinit(void)
{
8010391d:	55                   	push   %ebp
8010391e:	89 e5                	mov    %esp,%ebp
80103920:	83 ec 38             	sub    $0x38,%esp
  struct mp *mp;
  struct mpconf *conf;
  struct mpproc *proc;
  struct mpioapic *ioapic;

  bcpu = &cpus[0];
80103923:	c7 05 a4 c6 10 80 80 	movl   $0x80110980,0x8010c6a4
8010392a:	09 11 80 
  if((conf = mpconfig(&mp)) == 0)
8010392d:	8d 45 e0             	lea    -0x20(%ebp),%eax
80103930:	89 04 24             	mov    %eax,(%esp)
80103933:	e8 38 ff ff ff       	call   80103870 <mpconfig>
80103938:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010393b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010393f:	0f 84 9c 01 00 00    	je     80103ae1 <mpinit+0x1c4>
    return;
  ismp = 1;
80103945:	c7 05 64 09 11 80 01 	movl   $0x1,0x80110964
8010394c:	00 00 00 
  lapic = (uint*)conf->lapicaddr;
8010394f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103952:	8b 40 24             	mov    0x24(%eax),%eax
80103955:	a3 dc 08 11 80       	mov    %eax,0x801108dc
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
8010395a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010395d:	83 c0 2c             	add    $0x2c,%eax
80103960:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103963:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103966:	0f b7 40 04          	movzwl 0x4(%eax),%eax
8010396a:	0f b7 d0             	movzwl %ax,%edx
8010396d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103970:	01 d0                	add    %edx,%eax
80103972:	89 45 ec             	mov    %eax,-0x14(%ebp)
80103975:	e9 f4 00 00 00       	jmp    80103a6e <mpinit+0x151>
    switch(*p){
8010397a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010397d:	0f b6 00             	movzbl (%eax),%eax
80103980:	0f b6 c0             	movzbl %al,%eax
80103983:	83 f8 04             	cmp    $0x4,%eax
80103986:	0f 87 bf 00 00 00    	ja     80103a4b <mpinit+0x12e>
8010398c:	8b 04 85 f0 95 10 80 	mov    -0x7fef6a10(,%eax,4),%eax
80103993:	ff e0                	jmp    *%eax
    case MPPROC:
      proc = (struct mpproc*)p;
80103995:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103998:	89 45 e8             	mov    %eax,-0x18(%ebp)
      if(ncpu != proc->apicid){
8010399b:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010399e:	0f b6 40 01          	movzbl 0x1(%eax),%eax
801039a2:	0f b6 d0             	movzbl %al,%edx
801039a5:	a1 60 0f 11 80       	mov    0x80110f60,%eax
801039aa:	39 c2                	cmp    %eax,%edx
801039ac:	74 2d                	je     801039db <mpinit+0xbe>
        cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid);
801039ae:	8b 45 e8             	mov    -0x18(%ebp),%eax
801039b1:	0f b6 40 01          	movzbl 0x1(%eax),%eax
801039b5:	0f b6 d0             	movzbl %al,%edx
801039b8:	a1 60 0f 11 80       	mov    0x80110f60,%eax
801039bd:	89 54 24 08          	mov    %edx,0x8(%esp)
801039c1:	89 44 24 04          	mov    %eax,0x4(%esp)
801039c5:	c7 04 24 b2 95 10 80 	movl   $0x801095b2,(%esp)
801039cc:	e8 c5 c9 ff ff       	call   80100396 <cprintf>
        ismp = 0;
801039d1:	c7 05 64 09 11 80 00 	movl   $0x0,0x80110964
801039d8:	00 00 00 
      }
      if(proc->flags & MPBOOT)
801039db:	8b 45 e8             	mov    -0x18(%ebp),%eax
801039de:	0f b6 40 03          	movzbl 0x3(%eax),%eax
801039e2:	0f b6 c0             	movzbl %al,%eax
801039e5:	83 e0 02             	and    $0x2,%eax
801039e8:	85 c0                	test   %eax,%eax
801039ea:	74 15                	je     80103a01 <mpinit+0xe4>
        bcpu = &cpus[ncpu];
801039ec:	a1 60 0f 11 80       	mov    0x80110f60,%eax
801039f1:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
801039f7:	05 80 09 11 80       	add    $0x80110980,%eax
801039fc:	a3 a4 c6 10 80       	mov    %eax,0x8010c6a4
      cpus[ncpu].id = ncpu;
80103a01:	8b 15 60 0f 11 80    	mov    0x80110f60,%edx
80103a07:	a1 60 0f 11 80       	mov    0x80110f60,%eax
80103a0c:	69 d2 bc 00 00 00    	imul   $0xbc,%edx,%edx
80103a12:	81 c2 80 09 11 80    	add    $0x80110980,%edx
80103a18:	88 02                	mov    %al,(%edx)
      ncpu++;
80103a1a:	a1 60 0f 11 80       	mov    0x80110f60,%eax
80103a1f:	83 c0 01             	add    $0x1,%eax
80103a22:	a3 60 0f 11 80       	mov    %eax,0x80110f60
      p += sizeof(struct mpproc);
80103a27:	83 45 f4 14          	addl   $0x14,-0xc(%ebp)
      continue;
80103a2b:	eb 41                	jmp    80103a6e <mpinit+0x151>
    case MPIOAPIC:
      ioapic = (struct mpioapic*)p;
80103a2d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a30:	89 45 e4             	mov    %eax,-0x1c(%ebp)
      ioapicid = ioapic->apicno;
80103a33:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80103a36:	0f b6 40 01          	movzbl 0x1(%eax),%eax
80103a3a:	a2 60 09 11 80       	mov    %al,0x80110960
      p += sizeof(struct mpioapic);
80103a3f:	83 45 f4 08          	addl   $0x8,-0xc(%ebp)
      continue;
80103a43:	eb 29                	jmp    80103a6e <mpinit+0x151>
    case MPBUS:
    case MPIOINTR:
    case MPLINTR:
      p += 8;
80103a45:	83 45 f4 08          	addl   $0x8,-0xc(%ebp)
      continue;
80103a49:	eb 23                	jmp    80103a6e <mpinit+0x151>
    default:
      cprintf("mpinit: unknown config type %x\n", *p);
80103a4b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a4e:	0f b6 00             	movzbl (%eax),%eax
80103a51:	0f b6 c0             	movzbl %al,%eax
80103a54:	89 44 24 04          	mov    %eax,0x4(%esp)
80103a58:	c7 04 24 d0 95 10 80 	movl   $0x801095d0,(%esp)
80103a5f:	e8 32 c9 ff ff       	call   80100396 <cprintf>
      ismp = 0;
80103a64:	c7 05 64 09 11 80 00 	movl   $0x0,0x80110964
80103a6b:	00 00 00 
  bcpu = &cpus[0];
  if((conf = mpconfig(&mp)) == 0)
    return;
  ismp = 1;
  lapic = (uint*)conf->lapicaddr;
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103a6e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a71:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80103a74:	0f 82 00 ff ff ff    	jb     8010397a <mpinit+0x5d>
    default:
      cprintf("mpinit: unknown config type %x\n", *p);
      ismp = 0;
    }
  }
  if(!ismp){
80103a7a:	a1 64 09 11 80       	mov    0x80110964,%eax
80103a7f:	85 c0                	test   %eax,%eax
80103a81:	75 1d                	jne    80103aa0 <mpinit+0x183>
    // Didn't like what we found; fall back to no MP.
    ncpu = 1;
80103a83:	c7 05 60 0f 11 80 01 	movl   $0x1,0x80110f60
80103a8a:	00 00 00 
    lapic = 0;
80103a8d:	c7 05 dc 08 11 80 00 	movl   $0x0,0x801108dc
80103a94:	00 00 00 
    ioapicid = 0;
80103a97:	c6 05 60 09 11 80 00 	movb   $0x0,0x80110960
80103a9e:	eb 41                	jmp    80103ae1 <mpinit+0x1c4>
    return;
  }

  if(mp->imcrp){
80103aa0:	8b 45 e0             	mov    -0x20(%ebp),%eax
80103aa3:	0f b6 40 0c          	movzbl 0xc(%eax),%eax
80103aa7:	84 c0                	test   %al,%al
80103aa9:	74 36                	je     80103ae1 <mpinit+0x1c4>
    // Bochs doesn't support IMCR, so this doesn't run on Bochs.
    // But it would on real hardware.
    outb(0x22, 0x70);   // Select IMCR
80103aab:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
80103ab2:	00 
80103ab3:	c7 04 24 22 00 00 00 	movl   $0x22,(%esp)
80103aba:	e8 0c fc ff ff       	call   801036cb <outb>
    outb(0x23, inb(0x23) | 1);  // Mask external interrupts.
80103abf:	c7 04 24 23 00 00 00 	movl   $0x23,(%esp)
80103ac6:	e8 d6 fb ff ff       	call   801036a1 <inb>
80103acb:	83 c8 01             	or     $0x1,%eax
80103ace:	0f b6 c0             	movzbl %al,%eax
80103ad1:	89 44 24 04          	mov    %eax,0x4(%esp)
80103ad5:	c7 04 24 23 00 00 00 	movl   $0x23,(%esp)
80103adc:	e8 ea fb ff ff       	call   801036cb <outb>
  }
}
80103ae1:	c9                   	leave  
80103ae2:	c3                   	ret    
80103ae3:	90                   	nop

80103ae4 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80103ae4:	55                   	push   %ebp
80103ae5:	89 e5                	mov    %esp,%ebp
80103ae7:	83 ec 08             	sub    $0x8,%esp
80103aea:	8b 55 08             	mov    0x8(%ebp),%edx
80103aed:	8b 45 0c             	mov    0xc(%ebp),%eax
80103af0:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80103af4:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103af7:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80103afb:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80103aff:	ee                   	out    %al,(%dx)
}
80103b00:	c9                   	leave  
80103b01:	c3                   	ret    

80103b02 <picsetmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);

static void
picsetmask(ushort mask)
{
80103b02:	55                   	push   %ebp
80103b03:	89 e5                	mov    %esp,%ebp
80103b05:	83 ec 0c             	sub    $0xc,%esp
80103b08:	8b 45 08             	mov    0x8(%ebp),%eax
80103b0b:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  irqmask = mask;
80103b0f:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80103b13:	66 a3 00 c0 10 80    	mov    %ax,0x8010c000
  outb(IO_PIC1+1, mask);
80103b19:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80103b1d:	0f b6 c0             	movzbl %al,%eax
80103b20:	89 44 24 04          	mov    %eax,0x4(%esp)
80103b24:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103b2b:	e8 b4 ff ff ff       	call   80103ae4 <outb>
  outb(IO_PIC2+1, mask >> 8);
80103b30:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80103b34:	66 c1 e8 08          	shr    $0x8,%ax
80103b38:	0f b6 c0             	movzbl %al,%eax
80103b3b:	89 44 24 04          	mov    %eax,0x4(%esp)
80103b3f:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103b46:	e8 99 ff ff ff       	call   80103ae4 <outb>
}
80103b4b:	c9                   	leave  
80103b4c:	c3                   	ret    

80103b4d <picenable>:

void
picenable(int irq)
{
80103b4d:	55                   	push   %ebp
80103b4e:	89 e5                	mov    %esp,%ebp
80103b50:	53                   	push   %ebx
80103b51:	83 ec 04             	sub    $0x4,%esp
  picsetmask(irqmask & ~(1<<irq));
80103b54:	8b 45 08             	mov    0x8(%ebp),%eax
80103b57:	ba 01 00 00 00       	mov    $0x1,%edx
80103b5c:	89 d3                	mov    %edx,%ebx
80103b5e:	89 c1                	mov    %eax,%ecx
80103b60:	d3 e3                	shl    %cl,%ebx
80103b62:	89 d8                	mov    %ebx,%eax
80103b64:	89 c2                	mov    %eax,%edx
80103b66:	f7 d2                	not    %edx
80103b68:	0f b7 05 00 c0 10 80 	movzwl 0x8010c000,%eax
80103b6f:	21 d0                	and    %edx,%eax
80103b71:	0f b7 c0             	movzwl %ax,%eax
80103b74:	89 04 24             	mov    %eax,(%esp)
80103b77:	e8 86 ff ff ff       	call   80103b02 <picsetmask>
}
80103b7c:	83 c4 04             	add    $0x4,%esp
80103b7f:	5b                   	pop    %ebx
80103b80:	5d                   	pop    %ebp
80103b81:	c3                   	ret    

80103b82 <picinit>:

// Initialize the 8259A interrupt controllers.
void
picinit(void)
{
80103b82:	55                   	push   %ebp
80103b83:	89 e5                	mov    %esp,%ebp
80103b85:	83 ec 08             	sub    $0x8,%esp
  // mask all interrupts
  outb(IO_PIC1+1, 0xFF);
80103b88:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
80103b8f:	00 
80103b90:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103b97:	e8 48 ff ff ff       	call   80103ae4 <outb>
  outb(IO_PIC2+1, 0xFF);
80103b9c:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
80103ba3:	00 
80103ba4:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103bab:	e8 34 ff ff ff       	call   80103ae4 <outb>

  // ICW1:  0001g0hi
  //    g:  0 = edge triggering, 1 = level triggering
  //    h:  0 = cascaded PICs, 1 = master only
  //    i:  0 = no ICW4, 1 = ICW4 required
  outb(IO_PIC1, 0x11);
80103bb0:	c7 44 24 04 11 00 00 	movl   $0x11,0x4(%esp)
80103bb7:	00 
80103bb8:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80103bbf:	e8 20 ff ff ff       	call   80103ae4 <outb>

  // ICW2:  Vector offset
  outb(IO_PIC1+1, T_IRQ0);
80103bc4:	c7 44 24 04 20 00 00 	movl   $0x20,0x4(%esp)
80103bcb:	00 
80103bcc:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103bd3:	e8 0c ff ff ff       	call   80103ae4 <outb>

  // ICW3:  (master PIC) bit mask of IR lines connected to slaves
  //        (slave PIC) 3-bit # of slave's connection to master
  outb(IO_PIC1+1, 1<<IRQ_SLAVE);
80103bd8:	c7 44 24 04 04 00 00 	movl   $0x4,0x4(%esp)
80103bdf:	00 
80103be0:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103be7:	e8 f8 fe ff ff       	call   80103ae4 <outb>
  //    m:  0 = slave PIC, 1 = master PIC
  //      (ignored when b is 0, as the master/slave role
  //      can be hardwired).
  //    a:  1 = Automatic EOI mode
  //    p:  0 = MCS-80/85 mode, 1 = intel x86 mode
  outb(IO_PIC1+1, 0x3);
80103bec:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
80103bf3:	00 
80103bf4:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103bfb:	e8 e4 fe ff ff       	call   80103ae4 <outb>

  // Set up slave (8259A-2)
  outb(IO_PIC2, 0x11);                  // ICW1
80103c00:	c7 44 24 04 11 00 00 	movl   $0x11,0x4(%esp)
80103c07:	00 
80103c08:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80103c0f:	e8 d0 fe ff ff       	call   80103ae4 <outb>
  outb(IO_PIC2+1, T_IRQ0 + 8);      // ICW2
80103c14:	c7 44 24 04 28 00 00 	movl   $0x28,0x4(%esp)
80103c1b:	00 
80103c1c:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103c23:	e8 bc fe ff ff       	call   80103ae4 <outb>
  outb(IO_PIC2+1, IRQ_SLAVE);           // ICW3
80103c28:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
80103c2f:	00 
80103c30:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103c37:	e8 a8 fe ff ff       	call   80103ae4 <outb>
  // NB Automatic EOI mode doesn't tend to work on the slave.
  // Linux source code says it's "to be investigated".
  outb(IO_PIC2+1, 0x3);                 // ICW4
80103c3c:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
80103c43:	00 
80103c44:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103c4b:	e8 94 fe ff ff       	call   80103ae4 <outb>

  // OCW3:  0ef01prs
  //   ef:  0x = NOP, 10 = clear specific mask, 11 = set specific mask
  //    p:  0 = no polling, 1 = polling mode
  //   rs:  0x = NOP, 10 = read IRR, 11 = read ISR
  outb(IO_PIC1, 0x68);             // clear specific mask
80103c50:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
80103c57:	00 
80103c58:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80103c5f:	e8 80 fe ff ff       	call   80103ae4 <outb>
  outb(IO_PIC1, 0x0a);             // read IRR by default
80103c64:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80103c6b:	00 
80103c6c:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80103c73:	e8 6c fe ff ff       	call   80103ae4 <outb>

  outb(IO_PIC2, 0x68);             // OCW3
80103c78:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
80103c7f:	00 
80103c80:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80103c87:	e8 58 fe ff ff       	call   80103ae4 <outb>
  outb(IO_PIC2, 0x0a);             // OCW3
80103c8c:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80103c93:	00 
80103c94:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80103c9b:	e8 44 fe ff ff       	call   80103ae4 <outb>

  if(irqmask != 0xFFFF)
80103ca0:	0f b7 05 00 c0 10 80 	movzwl 0x8010c000,%eax
80103ca7:	66 83 f8 ff          	cmp    $0xffff,%ax
80103cab:	74 12                	je     80103cbf <picinit+0x13d>
    picsetmask(irqmask);
80103cad:	0f b7 05 00 c0 10 80 	movzwl 0x8010c000,%eax
80103cb4:	0f b7 c0             	movzwl %ax,%eax
80103cb7:	89 04 24             	mov    %eax,(%esp)
80103cba:	e8 43 fe ff ff       	call   80103b02 <picsetmask>
}
80103cbf:	c9                   	leave  
80103cc0:	c3                   	ret    
80103cc1:	66 90                	xchg   %ax,%ax
80103cc3:	90                   	nop

80103cc4 <pipealloc>:
  int writeopen;  // write fd is still open
};

int
pipealloc(struct file **f0, struct file **f1)
{
80103cc4:	55                   	push   %ebp
80103cc5:	89 e5                	mov    %esp,%ebp
80103cc7:	83 ec 28             	sub    $0x28,%esp
  struct pipe *p;

  p = 0;
80103cca:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  *f0 = *f1 = 0;
80103cd1:	8b 45 0c             	mov    0xc(%ebp),%eax
80103cd4:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
80103cda:	8b 45 0c             	mov    0xc(%ebp),%eax
80103cdd:	8b 10                	mov    (%eax),%edx
80103cdf:	8b 45 08             	mov    0x8(%ebp),%eax
80103ce2:	89 10                	mov    %edx,(%eax)
  if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
80103ce4:	e8 47 d2 ff ff       	call   80100f30 <filealloc>
80103ce9:	8b 55 08             	mov    0x8(%ebp),%edx
80103cec:	89 02                	mov    %eax,(%edx)
80103cee:	8b 45 08             	mov    0x8(%ebp),%eax
80103cf1:	8b 00                	mov    (%eax),%eax
80103cf3:	85 c0                	test   %eax,%eax
80103cf5:	0f 84 c8 00 00 00    	je     80103dc3 <pipealloc+0xff>
80103cfb:	e8 30 d2 ff ff       	call   80100f30 <filealloc>
80103d00:	8b 55 0c             	mov    0xc(%ebp),%edx
80103d03:	89 02                	mov    %eax,(%edx)
80103d05:	8b 45 0c             	mov    0xc(%ebp),%eax
80103d08:	8b 00                	mov    (%eax),%eax
80103d0a:	85 c0                	test   %eax,%eax
80103d0c:	0f 84 b1 00 00 00    	je     80103dc3 <pipealloc+0xff>
    goto bad;
  if((p = (struct pipe*)kalloc()) == 0)
80103d12:	e8 4f ee ff ff       	call   80102b66 <kalloc>
80103d17:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103d1a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103d1e:	0f 84 9e 00 00 00    	je     80103dc2 <pipealloc+0xfe>
    goto bad;
  p->readopen = 1;
80103d24:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d27:	c7 80 3c 02 00 00 01 	movl   $0x1,0x23c(%eax)
80103d2e:	00 00 00 
  p->writeopen = 1;
80103d31:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d34:	c7 80 40 02 00 00 01 	movl   $0x1,0x240(%eax)
80103d3b:	00 00 00 
  p->nwrite = 0;
80103d3e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d41:	c7 80 38 02 00 00 00 	movl   $0x0,0x238(%eax)
80103d48:	00 00 00 
  p->nread = 0;
80103d4b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d4e:	c7 80 34 02 00 00 00 	movl   $0x0,0x234(%eax)
80103d55:	00 00 00 
  initlock(&p->lock, "pipe");
80103d58:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d5b:	c7 44 24 04 04 96 10 	movl   $0x80109604,0x4(%esp)
80103d62:	80 
80103d63:	89 04 24             	mov    %eax,(%esp)
80103d66:	e8 7b 1e 00 00       	call   80105be6 <initlock>
  (*f0)->type = FD_PIPE;
80103d6b:	8b 45 08             	mov    0x8(%ebp),%eax
80103d6e:	8b 00                	mov    (%eax),%eax
80103d70:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f0)->readable = 1;
80103d76:	8b 45 08             	mov    0x8(%ebp),%eax
80103d79:	8b 00                	mov    (%eax),%eax
80103d7b:	c6 40 08 01          	movb   $0x1,0x8(%eax)
  (*f0)->writable = 0;
80103d7f:	8b 45 08             	mov    0x8(%ebp),%eax
80103d82:	8b 00                	mov    (%eax),%eax
80103d84:	c6 40 09 00          	movb   $0x0,0x9(%eax)
  (*f0)->pipe = p;
80103d88:	8b 45 08             	mov    0x8(%ebp),%eax
80103d8b:	8b 00                	mov    (%eax),%eax
80103d8d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103d90:	89 50 0c             	mov    %edx,0xc(%eax)
  (*f1)->type = FD_PIPE;
80103d93:	8b 45 0c             	mov    0xc(%ebp),%eax
80103d96:	8b 00                	mov    (%eax),%eax
80103d98:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f1)->readable = 0;
80103d9e:	8b 45 0c             	mov    0xc(%ebp),%eax
80103da1:	8b 00                	mov    (%eax),%eax
80103da3:	c6 40 08 00          	movb   $0x0,0x8(%eax)
  (*f1)->writable = 1;
80103da7:	8b 45 0c             	mov    0xc(%ebp),%eax
80103daa:	8b 00                	mov    (%eax),%eax
80103dac:	c6 40 09 01          	movb   $0x1,0x9(%eax)
  (*f1)->pipe = p;
80103db0:	8b 45 0c             	mov    0xc(%ebp),%eax
80103db3:	8b 00                	mov    (%eax),%eax
80103db5:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103db8:	89 50 0c             	mov    %edx,0xc(%eax)
  return 0;
80103dbb:	b8 00 00 00 00       	mov    $0x0,%eax
80103dc0:	eb 43                	jmp    80103e05 <pipealloc+0x141>
  p = 0;
  *f0 = *f1 = 0;
  if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
    goto bad;
  if((p = (struct pipe*)kalloc()) == 0)
    goto bad;
80103dc2:	90                   	nop
  (*f1)->pipe = p;
  return 0;

//PAGEBREAK: 20
 bad:
  if(p)
80103dc3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103dc7:	74 0b                	je     80103dd4 <pipealloc+0x110>
    kfree((char*)p);
80103dc9:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103dcc:	89 04 24             	mov    %eax,(%esp)
80103dcf:	e8 9e ec ff ff       	call   80102a72 <kfree>
  if(*f0)
80103dd4:	8b 45 08             	mov    0x8(%ebp),%eax
80103dd7:	8b 00                	mov    (%eax),%eax
80103dd9:	85 c0                	test   %eax,%eax
80103ddb:	74 0d                	je     80103dea <pipealloc+0x126>
    fileclose(*f0);
80103ddd:	8b 45 08             	mov    0x8(%ebp),%eax
80103de0:	8b 00                	mov    (%eax),%eax
80103de2:	89 04 24             	mov    %eax,(%esp)
80103de5:	e8 ee d1 ff ff       	call   80100fd8 <fileclose>
  if(*f1)
80103dea:	8b 45 0c             	mov    0xc(%ebp),%eax
80103ded:	8b 00                	mov    (%eax),%eax
80103def:	85 c0                	test   %eax,%eax
80103df1:	74 0d                	je     80103e00 <pipealloc+0x13c>
    fileclose(*f1);
80103df3:	8b 45 0c             	mov    0xc(%ebp),%eax
80103df6:	8b 00                	mov    (%eax),%eax
80103df8:	89 04 24             	mov    %eax,(%esp)
80103dfb:	e8 d8 d1 ff ff       	call   80100fd8 <fileclose>
  return -1;
80103e00:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80103e05:	c9                   	leave  
80103e06:	c3                   	ret    

80103e07 <pipeclose>:

void
pipeclose(struct pipe *p, int writable)
{
80103e07:	55                   	push   %ebp
80103e08:	89 e5                	mov    %esp,%ebp
80103e0a:	83 ec 18             	sub    $0x18,%esp
  acquire(&p->lock);
80103e0d:	8b 45 08             	mov    0x8(%ebp),%eax
80103e10:	89 04 24             	mov    %eax,(%esp)
80103e13:	e8 ef 1d 00 00       	call   80105c07 <acquire>
  if(writable){
80103e18:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80103e1c:	74 1f                	je     80103e3d <pipeclose+0x36>
    p->writeopen = 0;
80103e1e:	8b 45 08             	mov    0x8(%ebp),%eax
80103e21:	c7 80 40 02 00 00 00 	movl   $0x0,0x240(%eax)
80103e28:	00 00 00 
    wakeup(&p->nread);
80103e2b:	8b 45 08             	mov    0x8(%ebp),%eax
80103e2e:	05 34 02 00 00       	add    $0x234,%eax
80103e33:	89 04 24             	mov    %eax,(%esp)
80103e36:	e8 da 0c 00 00       	call   80104b15 <wakeup>
80103e3b:	eb 1d                	jmp    80103e5a <pipeclose+0x53>
  } else {
    p->readopen = 0;
80103e3d:	8b 45 08             	mov    0x8(%ebp),%eax
80103e40:	c7 80 3c 02 00 00 00 	movl   $0x0,0x23c(%eax)
80103e47:	00 00 00 
    wakeup(&p->nwrite);
80103e4a:	8b 45 08             	mov    0x8(%ebp),%eax
80103e4d:	05 38 02 00 00       	add    $0x238,%eax
80103e52:	89 04 24             	mov    %eax,(%esp)
80103e55:	e8 bb 0c 00 00       	call   80104b15 <wakeup>
  }
  if(p->readopen == 0 && p->writeopen == 0){
80103e5a:	8b 45 08             	mov    0x8(%ebp),%eax
80103e5d:	8b 80 3c 02 00 00    	mov    0x23c(%eax),%eax
80103e63:	85 c0                	test   %eax,%eax
80103e65:	75 25                	jne    80103e8c <pipeclose+0x85>
80103e67:	8b 45 08             	mov    0x8(%ebp),%eax
80103e6a:	8b 80 40 02 00 00    	mov    0x240(%eax),%eax
80103e70:	85 c0                	test   %eax,%eax
80103e72:	75 18                	jne    80103e8c <pipeclose+0x85>
    release(&p->lock);
80103e74:	8b 45 08             	mov    0x8(%ebp),%eax
80103e77:	89 04 24             	mov    %eax,(%esp)
80103e7a:	e8 ea 1d 00 00       	call   80105c69 <release>
    kfree((char*)p);
80103e7f:	8b 45 08             	mov    0x8(%ebp),%eax
80103e82:	89 04 24             	mov    %eax,(%esp)
80103e85:	e8 e8 eb ff ff       	call   80102a72 <kfree>
80103e8a:	eb 0b                	jmp    80103e97 <pipeclose+0x90>
  } else
    release(&p->lock);
80103e8c:	8b 45 08             	mov    0x8(%ebp),%eax
80103e8f:	89 04 24             	mov    %eax,(%esp)
80103e92:	e8 d2 1d 00 00       	call   80105c69 <release>
}
80103e97:	c9                   	leave  
80103e98:	c3                   	ret    

80103e99 <pipewrite>:

//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
80103e99:	55                   	push   %ebp
80103e9a:	89 e5                	mov    %esp,%ebp
80103e9c:	53                   	push   %ebx
80103e9d:	83 ec 24             	sub    $0x24,%esp
  int i;

  acquire(&p->lock);
80103ea0:	8b 45 08             	mov    0x8(%ebp),%eax
80103ea3:	89 04 24             	mov    %eax,(%esp)
80103ea6:	e8 5c 1d 00 00       	call   80105c07 <acquire>
  for(i = 0; i < n; i++){
80103eab:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80103eb2:	e9 a8 00 00 00       	jmp    80103f5f <pipewrite+0xc6>
    while(p->nwrite == p->nread + PIPESIZE){  //DOC: pipewrite-full
      if(p->readopen == 0 || proc->killed){
80103eb7:	8b 45 08             	mov    0x8(%ebp),%eax
80103eba:	8b 80 3c 02 00 00    	mov    0x23c(%eax),%eax
80103ec0:	85 c0                	test   %eax,%eax
80103ec2:	74 0d                	je     80103ed1 <pipewrite+0x38>
80103ec4:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80103eca:	8b 40 24             	mov    0x24(%eax),%eax
80103ecd:	85 c0                	test   %eax,%eax
80103ecf:	74 15                	je     80103ee6 <pipewrite+0x4d>
        release(&p->lock);
80103ed1:	8b 45 08             	mov    0x8(%ebp),%eax
80103ed4:	89 04 24             	mov    %eax,(%esp)
80103ed7:	e8 8d 1d 00 00       	call   80105c69 <release>
        return -1;
80103edc:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80103ee1:	e9 9f 00 00 00       	jmp    80103f85 <pipewrite+0xec>
      }
      wakeup(&p->nread);
80103ee6:	8b 45 08             	mov    0x8(%ebp),%eax
80103ee9:	05 34 02 00 00       	add    $0x234,%eax
80103eee:	89 04 24             	mov    %eax,(%esp)
80103ef1:	e8 1f 0c 00 00       	call   80104b15 <wakeup>
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
80103ef6:	8b 45 08             	mov    0x8(%ebp),%eax
80103ef9:	8b 55 08             	mov    0x8(%ebp),%edx
80103efc:	81 c2 38 02 00 00    	add    $0x238,%edx
80103f02:	89 44 24 04          	mov    %eax,0x4(%esp)
80103f06:	89 14 24             	mov    %edx,(%esp)
80103f09:	e8 c3 0a 00 00       	call   801049d1 <sleep>
80103f0e:	eb 01                	jmp    80103f11 <pipewrite+0x78>
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
    while(p->nwrite == p->nread + PIPESIZE){  //DOC: pipewrite-full
80103f10:	90                   	nop
80103f11:	8b 45 08             	mov    0x8(%ebp),%eax
80103f14:	8b 90 38 02 00 00    	mov    0x238(%eax),%edx
80103f1a:	8b 45 08             	mov    0x8(%ebp),%eax
80103f1d:	8b 80 34 02 00 00    	mov    0x234(%eax),%eax
80103f23:	05 00 02 00 00       	add    $0x200,%eax
80103f28:	39 c2                	cmp    %eax,%edx
80103f2a:	74 8b                	je     80103eb7 <pipewrite+0x1e>
        return -1;
      }
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
80103f2c:	8b 45 08             	mov    0x8(%ebp),%eax
80103f2f:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
80103f35:	89 c3                	mov    %eax,%ebx
80103f37:	81 e3 ff 01 00 00    	and    $0x1ff,%ebx
80103f3d:	8b 4d f4             	mov    -0xc(%ebp),%ecx
80103f40:	8b 55 0c             	mov    0xc(%ebp),%edx
80103f43:	01 ca                	add    %ecx,%edx
80103f45:	0f b6 0a             	movzbl (%edx),%ecx
80103f48:	8b 55 08             	mov    0x8(%ebp),%edx
80103f4b:	88 4c 1a 34          	mov    %cl,0x34(%edx,%ebx,1)
80103f4f:	8d 50 01             	lea    0x1(%eax),%edx
80103f52:	8b 45 08             	mov    0x8(%ebp),%eax
80103f55:	89 90 38 02 00 00    	mov    %edx,0x238(%eax)
pipewrite(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
80103f5b:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103f5f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103f62:	3b 45 10             	cmp    0x10(%ebp),%eax
80103f65:	7c a9                	jl     80103f10 <pipewrite+0x77>
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
  }
  wakeup(&p->nread);  //DOC: pipewrite-wakeup1
80103f67:	8b 45 08             	mov    0x8(%ebp),%eax
80103f6a:	05 34 02 00 00       	add    $0x234,%eax
80103f6f:	89 04 24             	mov    %eax,(%esp)
80103f72:	e8 9e 0b 00 00       	call   80104b15 <wakeup>
  release(&p->lock);
80103f77:	8b 45 08             	mov    0x8(%ebp),%eax
80103f7a:	89 04 24             	mov    %eax,(%esp)
80103f7d:	e8 e7 1c 00 00       	call   80105c69 <release>
  return n;
80103f82:	8b 45 10             	mov    0x10(%ebp),%eax
}
80103f85:	83 c4 24             	add    $0x24,%esp
80103f88:	5b                   	pop    %ebx
80103f89:	5d                   	pop    %ebp
80103f8a:	c3                   	ret    

80103f8b <piperead>:

int
piperead(struct pipe *p, char *addr, int n)
{
80103f8b:	55                   	push   %ebp
80103f8c:	89 e5                	mov    %esp,%ebp
80103f8e:	53                   	push   %ebx
80103f8f:	83 ec 24             	sub    $0x24,%esp
  int i;

  acquire(&p->lock);
80103f92:	8b 45 08             	mov    0x8(%ebp),%eax
80103f95:	89 04 24             	mov    %eax,(%esp)
80103f98:	e8 6a 1c 00 00       	call   80105c07 <acquire>
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
80103f9d:	eb 3a                	jmp    80103fd9 <piperead+0x4e>
    if(proc->killed){
80103f9f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80103fa5:	8b 40 24             	mov    0x24(%eax),%eax
80103fa8:	85 c0                	test   %eax,%eax
80103faa:	74 15                	je     80103fc1 <piperead+0x36>
      release(&p->lock);
80103fac:	8b 45 08             	mov    0x8(%ebp),%eax
80103faf:	89 04 24             	mov    %eax,(%esp)
80103fb2:	e8 b2 1c 00 00       	call   80105c69 <release>
      return -1;
80103fb7:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80103fbc:	e9 b7 00 00 00       	jmp    80104078 <piperead+0xed>
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
80103fc1:	8b 45 08             	mov    0x8(%ebp),%eax
80103fc4:	8b 55 08             	mov    0x8(%ebp),%edx
80103fc7:	81 c2 34 02 00 00    	add    $0x234,%edx
80103fcd:	89 44 24 04          	mov    %eax,0x4(%esp)
80103fd1:	89 14 24             	mov    %edx,(%esp)
80103fd4:	e8 f8 09 00 00       	call   801049d1 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
80103fd9:	8b 45 08             	mov    0x8(%ebp),%eax
80103fdc:	8b 90 34 02 00 00    	mov    0x234(%eax),%edx
80103fe2:	8b 45 08             	mov    0x8(%ebp),%eax
80103fe5:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
80103feb:	39 c2                	cmp    %eax,%edx
80103fed:	75 0d                	jne    80103ffc <piperead+0x71>
80103fef:	8b 45 08             	mov    0x8(%ebp),%eax
80103ff2:	8b 80 40 02 00 00    	mov    0x240(%eax),%eax
80103ff8:	85 c0                	test   %eax,%eax
80103ffa:	75 a3                	jne    80103f9f <piperead+0x14>
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
80103ffc:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104003:	eb 4a                	jmp    8010404f <piperead+0xc4>
    if(p->nread == p->nwrite)
80104005:	8b 45 08             	mov    0x8(%ebp),%eax
80104008:	8b 90 34 02 00 00    	mov    0x234(%eax),%edx
8010400e:	8b 45 08             	mov    0x8(%ebp),%eax
80104011:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
80104017:	39 c2                	cmp    %eax,%edx
80104019:	74 3e                	je     80104059 <piperead+0xce>
      break;
    addr[i] = p->data[p->nread++ % PIPESIZE];
8010401b:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010401e:	8b 45 0c             	mov    0xc(%ebp),%eax
80104021:	8d 0c 02             	lea    (%edx,%eax,1),%ecx
80104024:	8b 45 08             	mov    0x8(%ebp),%eax
80104027:	8b 80 34 02 00 00    	mov    0x234(%eax),%eax
8010402d:	89 c3                	mov    %eax,%ebx
8010402f:	81 e3 ff 01 00 00    	and    $0x1ff,%ebx
80104035:	8b 55 08             	mov    0x8(%ebp),%edx
80104038:	0f b6 54 1a 34       	movzbl 0x34(%edx,%ebx,1),%edx
8010403d:	88 11                	mov    %dl,(%ecx)
8010403f:	8d 50 01             	lea    0x1(%eax),%edx
80104042:	8b 45 08             	mov    0x8(%ebp),%eax
80104045:	89 90 34 02 00 00    	mov    %edx,0x234(%eax)
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
8010404b:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010404f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104052:	3b 45 10             	cmp    0x10(%ebp),%eax
80104055:	7c ae                	jl     80104005 <piperead+0x7a>
80104057:	eb 01                	jmp    8010405a <piperead+0xcf>
    if(p->nread == p->nwrite)
      break;
80104059:	90                   	nop
    addr[i] = p->data[p->nread++ % PIPESIZE];
  }
  wakeup(&p->nwrite);  //DOC: piperead-wakeup
8010405a:	8b 45 08             	mov    0x8(%ebp),%eax
8010405d:	05 38 02 00 00       	add    $0x238,%eax
80104062:	89 04 24             	mov    %eax,(%esp)
80104065:	e8 ab 0a 00 00       	call   80104b15 <wakeup>
  release(&p->lock);
8010406a:	8b 45 08             	mov    0x8(%ebp),%eax
8010406d:	89 04 24             	mov    %eax,(%esp)
80104070:	e8 f4 1b 00 00       	call   80105c69 <release>
  return i;
80104075:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80104078:	83 c4 24             	add    $0x24,%esp
8010407b:	5b                   	pop    %ebx
8010407c:	5d                   	pop    %ebp
8010407d:	c3                   	ret    
8010407e:	66 90                	xchg   %ax,%ax

80104080 <v2p>:
#define KERNBASE 0x80000000         // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM)  // Address where kernel is linked

#ifndef __ASSEMBLER__

static inline uint v2p(void *a) { return ((uint) (a))  - KERNBASE; }
80104080:	55                   	push   %ebp
80104081:	89 e5                	mov    %esp,%ebp
80104083:	8b 45 08             	mov    0x8(%ebp),%eax
80104086:	05 00 00 00 80       	add    $0x80000000,%eax
8010408b:	5d                   	pop    %ebp
8010408c:	c3                   	ret    

8010408d <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
8010408d:	55                   	push   %ebp
8010408e:	89 e5                	mov    %esp,%ebp
80104090:	8b 45 08             	mov    0x8(%ebp),%eax
80104093:	05 00 00 00 80       	add    $0x80000000,%eax
80104098:	5d                   	pop    %ebp
80104099:	c3                   	ret    

8010409a <readeflags>:
  asm volatile("ltr %0" : : "r" (sel));
}

static inline uint
readeflags(void)
{
8010409a:	55                   	push   %ebp
8010409b:	89 e5                	mov    %esp,%ebp
8010409d:	53                   	push   %ebx
8010409e:	83 ec 10             	sub    $0x10,%esp
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
801040a1:	9c                   	pushf  
801040a2:	5b                   	pop    %ebx
801040a3:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return eflags;
801040a6:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
801040a9:	83 c4 10             	add    $0x10,%esp
801040ac:	5b                   	pop    %ebx
801040ad:	5d                   	pop    %ebp
801040ae:	c3                   	ret    

801040af <sti>:
  asm volatile("cli");
}

static inline void
sti(void)
{
801040af:	55                   	push   %ebp
801040b0:	89 e5                	mov    %esp,%ebp
  asm volatile("sti");
801040b2:	fb                   	sti    
}
801040b3:	5d                   	pop    %ebp
801040b4:	c3                   	ret    

801040b5 <pinit>:
static int mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm);
static pte_t * walkpgdir(pde_t *pgdir, const void *va, int alloc);

void
pinit(void)
{
801040b5:	55                   	push   %ebp
801040b6:	89 e5                	mov    %esp,%ebp
801040b8:	83 ec 18             	sub    $0x18,%esp
	initlock(&ptable.lock, "ptable");
801040bb:	c7 44 24 04 09 96 10 	movl   $0x80109609,0x4(%esp)
801040c2:	80 
801040c3:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
801040ca:	e8 17 1b 00 00       	call   80105be6 <initlock>
}
801040cf:	c9                   	leave  
801040d0:	c3                   	ret    

801040d1 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
801040d1:	55                   	push   %ebp
801040d2:	89 e5                	mov    %esp,%ebp
801040d4:	83 ec 28             	sub    $0x28,%esp
	struct proc *p;
	char *sp;

	acquire(&ptable.lock);
801040d7:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
801040de:	e8 24 1b 00 00       	call   80105c07 <acquire>
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
801040e3:	c7 45 f4 f4 29 11 80 	movl   $0x801129f4,-0xc(%ebp)
801040ea:	eb 11                	jmp    801040fd <allocproc+0x2c>
		if(p->state == UNUSED)
801040ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
801040ef:	8b 40 0c             	mov    0xc(%eax),%eax
801040f2:	85 c0                	test   %eax,%eax
801040f4:	74 26                	je     8010411c <allocproc+0x4b>
{
	struct proc *p;
	char *sp;

	acquire(&ptable.lock);
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
801040f6:	81 45 f4 20 01 00 00 	addl   $0x120,-0xc(%ebp)
801040fd:	81 7d f4 f4 71 11 80 	cmpl   $0x801171f4,-0xc(%ebp)
80104104:	72 e6                	jb     801040ec <allocproc+0x1b>
		if(p->state == UNUSED)
			goto found;
	release(&ptable.lock);
80104106:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
8010410d:	e8 57 1b 00 00       	call   80105c69 <release>
	return 0;
80104112:	b8 00 00 00 00       	mov    $0x0,%eax
80104117:	e9 b5 00 00 00       	jmp    801041d1 <allocproc+0x100>
	char *sp;

	acquire(&ptable.lock);
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
		if(p->state == UNUSED)
			goto found;
8010411c:	90                   	nop
	release(&ptable.lock);
	return 0;

	found:
	p->state = EMBRYO;
8010411d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104120:	c7 40 0c 01 00 00 00 	movl   $0x1,0xc(%eax)
	p->pid = nextpid++;
80104127:	a1 20 c0 10 80       	mov    0x8010c020,%eax
8010412c:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010412f:	89 42 10             	mov    %eax,0x10(%edx)
80104132:	83 c0 01             	add    $0x1,%eax
80104135:	a3 20 c0 10 80       	mov    %eax,0x8010c020
	release(&ptable.lock);
8010413a:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104141:	e8 23 1b 00 00       	call   80105c69 <release>

	// Allocate kernel stack.
	if((p->kstack = kalloc()) == 0){
80104146:	e8 1b ea ff ff       	call   80102b66 <kalloc>
8010414b:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010414e:	89 42 08             	mov    %eax,0x8(%edx)
80104151:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104154:	8b 40 08             	mov    0x8(%eax),%eax
80104157:	85 c0                	test   %eax,%eax
80104159:	75 11                	jne    8010416c <allocproc+0x9b>
		p->state = UNUSED;
8010415b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010415e:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
		return 0;
80104165:	b8 00 00 00 00       	mov    $0x0,%eax
8010416a:	eb 65                	jmp    801041d1 <allocproc+0x100>
	}
	sp = p->kstack + KSTACKSIZE;
8010416c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010416f:	8b 40 08             	mov    0x8(%eax),%eax
80104172:	05 00 10 00 00       	add    $0x1000,%eax
80104177:	89 45 f0             	mov    %eax,-0x10(%ebp)

	// Leave room for trap frame.
	sp -= sizeof *p->tf;
8010417a:	83 6d f0 4c          	subl   $0x4c,-0x10(%ebp)
	p->tf = (struct trapframe*)sp;
8010417e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104181:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104184:	89 50 18             	mov    %edx,0x18(%eax)

	// Set up new context to start executing at forkret,
	// which returns to trapret.
	sp -= 4;
80104187:	83 6d f0 04          	subl   $0x4,-0x10(%ebp)
	*(uint*)sp = (uint)trapret;
8010418b:	ba c0 73 10 80       	mov    $0x801073c0,%edx
80104190:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104193:	89 10                	mov    %edx,(%eax)

	sp -= sizeof *p->context;
80104195:	83 6d f0 14          	subl   $0x14,-0x10(%ebp)
	p->context = (struct context*)sp;
80104199:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010419c:	8b 55 f0             	mov    -0x10(%ebp),%edx
8010419f:	89 50 1c             	mov    %edx,0x1c(%eax)
	memset(p->context, 0, sizeof *p->context);
801041a2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041a5:	8b 40 1c             	mov    0x1c(%eax),%eax
801041a8:	c7 44 24 08 14 00 00 	movl   $0x14,0x8(%esp)
801041af:	00 
801041b0:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801041b7:	00 
801041b8:	89 04 24             	mov    %eax,(%esp)
801041bb:	e8 a2 1c 00 00       	call   80105e62 <memset>
	p->context->eip = (uint)forkret;
801041c0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041c3:	8b 40 1c             	mov    0x1c(%eax),%eax
801041c6:	ba a5 49 10 80       	mov    $0x801049a5,%edx
801041cb:	89 50 10             	mov    %edx,0x10(%eax)

	return p;
801041ce:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
801041d1:	c9                   	leave  
801041d2:	c3                   	ret    

801041d3 <userinit>:

//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
801041d3:	55                   	push   %ebp
801041d4:	89 e5                	mov    %esp,%ebp
801041d6:	83 ec 28             	sub    $0x28,%esp
	struct proc *p;
	extern char _binary_initcode_start[], _binary_initcode_size[];

	p = allocproc();
801041d9:	e8 f3 fe ff ff       	call   801040d1 <allocproc>
801041de:	89 45 f4             	mov    %eax,-0xc(%ebp)
	initproc = p;
801041e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041e4:	a3 b0 c6 10 80       	mov    %eax,0x8010c6b0
	if((p->pgdir = setupkvm(kalloc)) == 0)
801041e9:	c7 04 24 66 2b 10 80 	movl   $0x80102b66,(%esp)
801041f0:	e8 d6 48 00 00       	call   80108acb <setupkvm>
801041f5:	8b 55 f4             	mov    -0xc(%ebp),%edx
801041f8:	89 42 04             	mov    %eax,0x4(%edx)
801041fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041fe:	8b 40 04             	mov    0x4(%eax),%eax
80104201:	85 c0                	test   %eax,%eax
80104203:	75 0c                	jne    80104211 <userinit+0x3e>
		panic("userinit: out of memory?");
80104205:	c7 04 24 10 96 10 80 	movl   $0x80109610,(%esp)
8010420c:	e8 21 c3 ff ff       	call   80100532 <panic>
	inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
80104211:	ba 2c 00 00 00       	mov    $0x2c,%edx
80104216:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104219:	8b 40 04             	mov    0x4(%eax),%eax
8010421c:	89 54 24 08          	mov    %edx,0x8(%esp)
80104220:	c7 44 24 04 40 c5 10 	movl   $0x8010c540,0x4(%esp)
80104227:	80 
80104228:	89 04 24             	mov    %eax,(%esp)
8010422b:	e8 f3 4a 00 00       	call   80108d23 <inituvm>
	p->sz = PGSIZE;
80104230:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104233:	c7 00 00 10 00 00    	movl   $0x1000,(%eax)
	memset(p->tf, 0, sizeof(*p->tf));
80104239:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010423c:	8b 40 18             	mov    0x18(%eax),%eax
8010423f:	c7 44 24 08 4c 00 00 	movl   $0x4c,0x8(%esp)
80104246:	00 
80104247:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010424e:	00 
8010424f:	89 04 24             	mov    %eax,(%esp)
80104252:	e8 0b 1c 00 00       	call   80105e62 <memset>
	p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
80104257:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010425a:	8b 40 18             	mov    0x18(%eax),%eax
8010425d:	66 c7 40 3c 23 00    	movw   $0x23,0x3c(%eax)
	p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
80104263:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104266:	8b 40 18             	mov    0x18(%eax),%eax
80104269:	66 c7 40 2c 2b 00    	movw   $0x2b,0x2c(%eax)
	p->tf->es = p->tf->ds;
8010426f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104272:	8b 40 18             	mov    0x18(%eax),%eax
80104275:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104278:	8b 52 18             	mov    0x18(%edx),%edx
8010427b:	0f b7 52 2c          	movzwl 0x2c(%edx),%edx
8010427f:	66 89 50 28          	mov    %dx,0x28(%eax)
	p->tf->ss = p->tf->ds;
80104283:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104286:	8b 40 18             	mov    0x18(%eax),%eax
80104289:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010428c:	8b 52 18             	mov    0x18(%edx),%edx
8010428f:	0f b7 52 2c          	movzwl 0x2c(%edx),%edx
80104293:	66 89 50 48          	mov    %dx,0x48(%eax)
	p->tf->eflags = FL_IF;
80104297:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010429a:	8b 40 18             	mov    0x18(%eax),%eax
8010429d:	c7 40 40 00 02 00 00 	movl   $0x200,0x40(%eax)
	p->tf->esp = PGSIZE;
801042a4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042a7:	8b 40 18             	mov    0x18(%eax),%eax
801042aa:	c7 40 44 00 10 00 00 	movl   $0x1000,0x44(%eax)
	p->tf->eip = 0;  // beginning of initcode.S
801042b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042b4:	8b 40 18             	mov    0x18(%eax),%eax
801042b7:	c7 40 38 00 00 00 00 	movl   $0x0,0x38(%eax)

	safestrcpy(p->name, "initcode", sizeof(p->name));
801042be:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042c1:	83 c0 6c             	add    $0x6c,%eax
801042c4:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
801042cb:	00 
801042cc:	c7 44 24 04 29 96 10 	movl   $0x80109629,0x4(%esp)
801042d3:	80 
801042d4:	89 04 24             	mov    %eax,(%esp)
801042d7:	e8 b6 1d 00 00       	call   80106092 <safestrcpy>
	p->cwd = namei("/");
801042dc:	c7 04 24 32 96 10 80 	movl   $0x80109632,(%esp)
801042e3:	e8 45 e1 ff ff       	call   8010242d <namei>
801042e8:	8b 55 f4             	mov    -0xc(%ebp),%edx
801042eb:	89 42 68             	mov    %eax,0x68(%edx)

	p->state = RUNNABLE;
801042ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042f1:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
}
801042f8:	c9                   	leave  
801042f9:	c3                   	ret    

801042fa <growproc>:

// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
801042fa:	55                   	push   %ebp
801042fb:	89 e5                	mov    %esp,%ebp
801042fd:	83 ec 28             	sub    $0x28,%esp
	uint sz;

	sz = proc->sz;
80104300:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104306:	8b 00                	mov    (%eax),%eax
80104308:	89 45 f4             	mov    %eax,-0xc(%ebp)
	if(n > 0){
8010430b:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010430f:	7e 34                	jle    80104345 <growproc+0x4b>
		if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
80104311:	8b 55 08             	mov    0x8(%ebp),%edx
80104314:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104317:	01 c2                	add    %eax,%edx
80104319:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010431f:	8b 40 04             	mov    0x4(%eax),%eax
80104322:	89 54 24 08          	mov    %edx,0x8(%esp)
80104326:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104329:	89 54 24 04          	mov    %edx,0x4(%esp)
8010432d:	89 04 24             	mov    %eax,(%esp)
80104330:	e8 68 4b 00 00       	call   80108e9d <allocuvm>
80104335:	89 45 f4             	mov    %eax,-0xc(%ebp)
80104338:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010433c:	75 41                	jne    8010437f <growproc+0x85>
			return -1;
8010433e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104343:	eb 58                	jmp    8010439d <growproc+0xa3>
	} else if(n < 0){
80104345:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80104349:	79 34                	jns    8010437f <growproc+0x85>
		if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
8010434b:	8b 55 08             	mov    0x8(%ebp),%edx
8010434e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104351:	01 c2                	add    %eax,%edx
80104353:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104359:	8b 40 04             	mov    0x4(%eax),%eax
8010435c:	89 54 24 08          	mov    %edx,0x8(%esp)
80104360:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104363:	89 54 24 04          	mov    %edx,0x4(%esp)
80104367:	89 04 24             	mov    %eax,(%esp)
8010436a:	e8 08 4c 00 00       	call   80108f77 <deallocuvm>
8010436f:	89 45 f4             	mov    %eax,-0xc(%ebp)
80104372:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80104376:	75 07                	jne    8010437f <growproc+0x85>
			return -1;
80104378:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010437d:	eb 1e                	jmp    8010439d <growproc+0xa3>
	}
	proc->sz = sz;
8010437f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104385:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104388:	89 10                	mov    %edx,(%eax)
	switchuvm(proc);
8010438a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104390:	89 04 24             	mov    %eax,(%esp)
80104393:	e8 24 48 00 00       	call   80108bbc <switchuvm>
	return 0;
80104398:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010439d:	c9                   	leave  
8010439e:	c3                   	ret    

8010439f <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
8010439f:	55                   	push   %ebp
801043a0:	89 e5                	mov    %esp,%ebp
801043a2:	57                   	push   %edi
801043a3:	56                   	push   %esi
801043a4:	53                   	push   %ebx
801043a5:	83 ec 2c             	sub    $0x2c,%esp
	int i, pid;
	struct proc *np;

	// Allocate process.
	if((np = allocproc()) == 0)
801043a8:	e8 24 fd ff ff       	call   801040d1 <allocproc>
801043ad:	89 45 e0             	mov    %eax,-0x20(%ebp)
801043b0:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
801043b4:	75 0a                	jne    801043c0 <fork+0x21>
		return -1;
801043b6:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801043bb:	e9 3a 01 00 00       	jmp    801044fa <fork+0x15b>

	// Copy process state from p.
	if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
801043c0:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801043c6:	8b 10                	mov    (%eax),%edx
801043c8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801043ce:	8b 40 04             	mov    0x4(%eax),%eax
801043d1:	89 54 24 04          	mov    %edx,0x4(%esp)
801043d5:	89 04 24             	mov    %eax,(%esp)
801043d8:	e8 36 4d 00 00       	call   80109113 <copyuvm>
801043dd:	8b 55 e0             	mov    -0x20(%ebp),%edx
801043e0:	89 42 04             	mov    %eax,0x4(%edx)
801043e3:	8b 45 e0             	mov    -0x20(%ebp),%eax
801043e6:	8b 40 04             	mov    0x4(%eax),%eax
801043e9:	85 c0                	test   %eax,%eax
801043eb:	75 2c                	jne    80104419 <fork+0x7a>
		kfree(np->kstack);
801043ed:	8b 45 e0             	mov    -0x20(%ebp),%eax
801043f0:	8b 40 08             	mov    0x8(%eax),%eax
801043f3:	89 04 24             	mov    %eax,(%esp)
801043f6:	e8 77 e6 ff ff       	call   80102a72 <kfree>
		np->kstack = 0;
801043fb:	8b 45 e0             	mov    -0x20(%ebp),%eax
801043fe:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
		np->state = UNUSED;
80104405:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104408:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
		return -1;
8010440f:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104414:	e9 e1 00 00 00       	jmp    801044fa <fork+0x15b>
	}
	np->sz = proc->sz;
80104419:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010441f:	8b 10                	mov    (%eax),%edx
80104421:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104424:	89 10                	mov    %edx,(%eax)
	np->parent = proc;
80104426:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
8010442d:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104430:	89 50 14             	mov    %edx,0x14(%eax)
	*np->tf = *proc->tf;
80104433:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104436:	8b 50 18             	mov    0x18(%eax),%edx
80104439:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010443f:	8b 40 18             	mov    0x18(%eax),%eax
80104442:	89 c3                	mov    %eax,%ebx
80104444:	b8 13 00 00 00       	mov    $0x13,%eax
80104449:	89 d7                	mov    %edx,%edi
8010444b:	89 de                	mov    %ebx,%esi
8010444d:	89 c1                	mov    %eax,%ecx
8010444f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)

	// Clear %eax so that fork returns 0 in the child.
	np->tf->eax = 0;
80104451:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104454:	8b 40 18             	mov    0x18(%eax),%eax
80104457:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)

	for(i = 0; i < NOFILE; i++)
8010445e:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
80104465:	eb 3d                	jmp    801044a4 <fork+0x105>
		if(proc->ofile[i])
80104467:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010446d:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80104470:	83 c2 08             	add    $0x8,%edx
80104473:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
80104477:	85 c0                	test   %eax,%eax
80104479:	74 25                	je     801044a0 <fork+0x101>
			np->ofile[i] = filedup(proc->ofile[i]);
8010447b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104481:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80104484:	83 c2 08             	add    $0x8,%edx
80104487:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
8010448b:	89 04 24             	mov    %eax,(%esp)
8010448e:	e8 fd ca ff ff       	call   80100f90 <filedup>
80104493:	8b 55 e0             	mov    -0x20(%ebp),%edx
80104496:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
80104499:	83 c1 08             	add    $0x8,%ecx
8010449c:	89 44 8a 08          	mov    %eax,0x8(%edx,%ecx,4)
	*np->tf = *proc->tf;

	// Clear %eax so that fork returns 0 in the child.
	np->tf->eax = 0;

	for(i = 0; i < NOFILE; i++)
801044a0:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
801044a4:	83 7d e4 0f          	cmpl   $0xf,-0x1c(%ebp)
801044a8:	7e bd                	jle    80104467 <fork+0xc8>
		if(proc->ofile[i])
			np->ofile[i] = filedup(proc->ofile[i]);
	np->cwd = idup(proc->cwd);
801044aa:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801044b0:	8b 40 68             	mov    0x68(%eax),%eax
801044b3:	89 04 24             	mov    %eax,(%esp)
801044b6:	e8 93 d3 ff ff       	call   8010184e <idup>
801044bb:	8b 55 e0             	mov    -0x20(%ebp),%edx
801044be:	89 42 68             	mov    %eax,0x68(%edx)

	pid = np->pid;
801044c1:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044c4:	8b 40 10             	mov    0x10(%eax),%eax
801044c7:	89 45 dc             	mov    %eax,-0x24(%ebp)
	np->state = RUNNABLE;
801044ca:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044cd:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
	safestrcpy(np->name, proc->name, sizeof(proc->name));
801044d4:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801044da:	8d 50 6c             	lea    0x6c(%eax),%edx
801044dd:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044e0:	83 c0 6c             	add    $0x6c,%eax
801044e3:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
801044ea:	00 
801044eb:	89 54 24 04          	mov    %edx,0x4(%esp)
801044ef:	89 04 24             	mov    %eax,(%esp)
801044f2:	e8 9b 1b 00 00       	call   80106092 <safestrcpy>
	return pid;
801044f7:	8b 45 dc             	mov    -0x24(%ebp),%eax
}
801044fa:	83 c4 2c             	add    $0x2c,%esp
801044fd:	5b                   	pop    %ebx
801044fe:	5e                   	pop    %esi
801044ff:	5f                   	pop    %edi
80104500:	5d                   	pop    %ebp
80104501:	c3                   	ret    

80104502 <exit>:
// Exit the current process.  Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
80104502:	55                   	push   %ebp
80104503:	89 e5                	mov    %esp,%ebp
80104505:	83 ec 28             	sub    $0x28,%esp
	struct proc *p;
	int fd;

	if(proc == initproc)
80104508:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
8010450f:	a1 b0 c6 10 80       	mov    0x8010c6b0,%eax
80104514:	39 c2                	cmp    %eax,%edx
80104516:	75 0c                	jne    80104524 <exit+0x22>
		panic("init exiting");
80104518:	c7 04 24 34 96 10 80 	movl   $0x80109634,(%esp)
8010451f:	e8 0e c0 ff ff       	call   80100532 <panic>

	// Close all open files.
	for(fd = 0; fd < NOFILE; fd++){
80104524:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
8010452b:	eb 44                	jmp    80104571 <exit+0x6f>
		if(proc->ofile[fd]){
8010452d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104533:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104536:	83 c2 08             	add    $0x8,%edx
80104539:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
8010453d:	85 c0                	test   %eax,%eax
8010453f:	74 2c                	je     8010456d <exit+0x6b>
			fileclose(proc->ofile[fd]);
80104541:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104547:	8b 55 f0             	mov    -0x10(%ebp),%edx
8010454a:	83 c2 08             	add    $0x8,%edx
8010454d:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
80104551:	89 04 24             	mov    %eax,(%esp)
80104554:	e8 7f ca ff ff       	call   80100fd8 <fileclose>
			proc->ofile[fd] = 0;
80104559:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010455f:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104562:	83 c2 08             	add    $0x8,%edx
80104565:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
8010456c:	00 

	if(proc == initproc)
		panic("init exiting");

	// Close all open files.
	for(fd = 0; fd < NOFILE; fd++){
8010456d:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
80104571:	83 7d f0 0f          	cmpl   $0xf,-0x10(%ebp)
80104575:	7e b6                	jle    8010452d <exit+0x2b>
			fileclose(proc->ofile[fd]);
			proc->ofile[fd] = 0;
		}
	}

	iput(proc->cwd);
80104577:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010457d:	8b 40 68             	mov    0x68(%eax),%eax
80104580:	89 04 24             	mov    %eax,(%esp)
80104583:	e8 97 d4 ff ff       	call   80101a1f <iput>
	proc->cwd = 0;
80104588:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010458e:	c7 40 68 00 00 00 00 	movl   $0x0,0x68(%eax)

	acquire(&ptable.lock);
80104595:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
8010459c:	e8 66 16 00 00       	call   80105c07 <acquire>

	// Parent might be sleeping in wait().
	wakeup1(proc->parent);
801045a1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801045a7:	8b 40 14             	mov    0x14(%eax),%eax
801045aa:	89 04 24             	mov    %eax,(%esp)
801045ad:	e8 f5 04 00 00       	call   80104aa7 <wakeup1>

	// Pass abandoned children to init.
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801045b2:	c7 45 f4 f4 29 11 80 	movl   $0x801129f4,-0xc(%ebp)
801045b9:	eb 3b                	jmp    801045f6 <exit+0xf4>
		if(p->parent == proc){
801045bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801045be:	8b 50 14             	mov    0x14(%eax),%edx
801045c1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801045c7:	39 c2                	cmp    %eax,%edx
801045c9:	75 24                	jne    801045ef <exit+0xed>
			p->parent = initproc;
801045cb:	8b 15 b0 c6 10 80    	mov    0x8010c6b0,%edx
801045d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801045d4:	89 50 14             	mov    %edx,0x14(%eax)
			if(p->state == ZOMBIE)
801045d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801045da:	8b 40 0c             	mov    0xc(%eax),%eax
801045dd:	83 f8 05             	cmp    $0x5,%eax
801045e0:	75 0d                	jne    801045ef <exit+0xed>
				wakeup1(initproc);
801045e2:	a1 b0 c6 10 80       	mov    0x8010c6b0,%eax
801045e7:	89 04 24             	mov    %eax,(%esp)
801045ea:	e8 b8 04 00 00       	call   80104aa7 <wakeup1>

	// Parent might be sleeping in wait().
	wakeup1(proc->parent);

	// Pass abandoned children to init.
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801045ef:	81 45 f4 20 01 00 00 	addl   $0x120,-0xc(%ebp)
801045f6:	81 7d f4 f4 71 11 80 	cmpl   $0x801171f4,-0xc(%ebp)
801045fd:	72 bc                	jb     801045bb <exit+0xb9>
				wakeup1(initproc);
		}
	}

	// Jump into the scheduler, never to return.
	proc->state = ZOMBIE;
801045ff:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104605:	c7 40 0c 05 00 00 00 	movl   $0x5,0xc(%eax)
	sched();
8010460c:	e8 b0 02 00 00       	call   801048c1 <sched>
	panic("zombie exit");
80104611:	c7 04 24 41 96 10 80 	movl   $0x80109641,(%esp)
80104618:	e8 15 bf ff ff       	call   80100532 <panic>

8010461d <wait>:

// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
8010461d:	55                   	push   %ebp
8010461e:	89 e5                	mov    %esp,%ebp
80104620:	83 ec 28             	sub    $0x28,%esp
	struct proc *p;
	int havekids, pid;

	acquire(&ptable.lock);
80104623:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
8010462a:	e8 d8 15 00 00       	call   80105c07 <acquire>
	for(;;){
		// Scan through table looking for zombie children.
		havekids = 0;
8010462f:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
		for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104636:	c7 45 f4 f4 29 11 80 	movl   $0x801129f4,-0xc(%ebp)
8010463d:	e9 9d 00 00 00       	jmp    801046df <wait+0xc2>
			if(p->parent != proc)
80104642:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104645:	8b 50 14             	mov    0x14(%eax),%edx
80104648:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010464e:	39 c2                	cmp    %eax,%edx
80104650:	0f 85 81 00 00 00    	jne    801046d7 <wait+0xba>
				continue;
			havekids = 1;
80104656:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
			if(p->state == ZOMBIE){
8010465d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104660:	8b 40 0c             	mov    0xc(%eax),%eax
80104663:	83 f8 05             	cmp    $0x5,%eax
80104666:	75 70                	jne    801046d8 <wait+0xbb>
				// Found one.
				pid = p->pid;
80104668:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010466b:	8b 40 10             	mov    0x10(%eax),%eax
8010466e:	89 45 ec             	mov    %eax,-0x14(%ebp)
				kfree(p->kstack);
80104671:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104674:	8b 40 08             	mov    0x8(%eax),%eax
80104677:	89 04 24             	mov    %eax,(%esp)
8010467a:	e8 f3 e3 ff ff       	call   80102a72 <kfree>
				p->kstack = 0;
8010467f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104682:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
				freevm(p->pgdir);
80104689:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010468c:	8b 40 04             	mov    0x4(%eax),%eax
8010468f:	89 04 24             	mov    %eax,(%esp)
80104692:	e8 9c 49 00 00       	call   80109033 <freevm>
				p->state = UNUSED;
80104697:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010469a:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
				p->pid = 0;
801046a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046a4:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
				p->parent = 0;
801046ab:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046ae:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
				p->name[0] = 0;
801046b5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046b8:	c6 40 6c 00          	movb   $0x0,0x6c(%eax)
				p->killed = 0;
801046bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046bf:	c7 40 24 00 00 00 00 	movl   $0x0,0x24(%eax)
				release(&ptable.lock);
801046c6:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
801046cd:	e8 97 15 00 00       	call   80105c69 <release>
				return pid;
801046d2:	8b 45 ec             	mov    -0x14(%ebp),%eax
801046d5:	eb 56                	jmp    8010472d <wait+0x110>
	for(;;){
		// Scan through table looking for zombie children.
		havekids = 0;
		for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
			if(p->parent != proc)
				continue;
801046d7:	90                   	nop

	acquire(&ptable.lock);
	for(;;){
		// Scan through table looking for zombie children.
		havekids = 0;
		for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801046d8:	81 45 f4 20 01 00 00 	addl   $0x120,-0xc(%ebp)
801046df:	81 7d f4 f4 71 11 80 	cmpl   $0x801171f4,-0xc(%ebp)
801046e6:	0f 82 56 ff ff ff    	jb     80104642 <wait+0x25>
				return pid;
			}
		}

		// No point waiting if we don't have any children.
		if(!havekids || proc->killed){
801046ec:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801046f0:	74 0d                	je     801046ff <wait+0xe2>
801046f2:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801046f8:	8b 40 24             	mov    0x24(%eax),%eax
801046fb:	85 c0                	test   %eax,%eax
801046fd:	74 13                	je     80104712 <wait+0xf5>
			release(&ptable.lock);
801046ff:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104706:	e8 5e 15 00 00       	call   80105c69 <release>
			return -1;
8010470b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104710:	eb 1b                	jmp    8010472d <wait+0x110>
		}

		// Wait for children to exit.  (See wakeup1 call in proc_exit.)
		sleep(proc, &ptable.lock);  //DOC: wait-sleep
80104712:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104718:	c7 44 24 04 c0 29 11 	movl   $0x801129c0,0x4(%esp)
8010471f:	80 
80104720:	89 04 24             	mov    %eax,(%esp)
80104723:	e8 a9 02 00 00       	call   801049d1 <sleep>
	}
80104728:	e9 02 ff ff ff       	jmp    8010462f <wait+0x12>
}
8010472d:	c9                   	leave  
8010472e:	c3                   	ret    

8010472f <register_handler>:

void
register_handler(sighandler_t sighandler)
{
8010472f:	55                   	push   %ebp
80104730:	89 e5                	mov    %esp,%ebp
80104732:	83 ec 28             	sub    $0x28,%esp
	char* addr = uva2ka(proc->pgdir, (char*)proc->tf->esp);
80104735:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010473b:	8b 40 18             	mov    0x18(%eax),%eax
8010473e:	8b 40 44             	mov    0x44(%eax),%eax
80104741:	89 c2                	mov    %eax,%edx
80104743:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104749:	8b 40 04             	mov    0x4(%eax),%eax
8010474c:	89 54 24 04          	mov    %edx,0x4(%esp)
80104750:	89 04 24             	mov    %eax,(%esp)
80104753:	e8 cc 4a 00 00       	call   80109224 <uva2ka>
80104758:	89 45 f4             	mov    %eax,-0xc(%ebp)
	if ((proc->tf->esp & 0xFFF) == 0)
8010475b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104761:	8b 40 18             	mov    0x18(%eax),%eax
80104764:	8b 40 44             	mov    0x44(%eax),%eax
80104767:	25 ff 0f 00 00       	and    $0xfff,%eax
8010476c:	85 c0                	test   %eax,%eax
8010476e:	75 0c                	jne    8010477c <register_handler+0x4d>
		panic("esp_offset == 0");
80104770:	c7 04 24 4d 96 10 80 	movl   $0x8010964d,(%esp)
80104777:	e8 b6 bd ff ff       	call   80100532 <panic>

	/* open a new frame */
	*(int*)(addr + ((proc->tf->esp - 4) & 0xFFF))
8010477c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104782:	8b 40 18             	mov    0x18(%eax),%eax
80104785:	8b 40 44             	mov    0x44(%eax),%eax
80104788:	83 e8 04             	sub    $0x4,%eax
8010478b:	89 c2                	mov    %eax,%edx
8010478d:	81 e2 ff 0f 00 00    	and    $0xfff,%edx
80104793:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104796:	01 c2                	add    %eax,%edx
        										  = proc->tf->eip;
80104798:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010479e:	8b 40 18             	mov    0x18(%eax),%eax
801047a1:	8b 40 38             	mov    0x38(%eax),%eax
801047a4:	89 02                	mov    %eax,(%edx)
	proc->tf->esp -= 4;
801047a6:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801047ac:	8b 40 18             	mov    0x18(%eax),%eax
801047af:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
801047b6:	8b 52 18             	mov    0x18(%edx),%edx
801047b9:	8b 52 44             	mov    0x44(%edx),%edx
801047bc:	83 ea 04             	sub    $0x4,%edx
801047bf:	89 50 44             	mov    %edx,0x44(%eax)

	/* update eip */
	proc->tf->eip = (uint)sighandler;
801047c2:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801047c8:	8b 40 18             	mov    0x18(%eax),%eax
801047cb:	8b 55 08             	mov    0x8(%ebp),%edx
801047ce:	89 50 38             	mov    %edx,0x38(%eax)
}
801047d1:	c9                   	leave  
801047d2:	c3                   	ret    

801047d3 <scheduler>:
//  - swtch to start running that process
//  - eventually that process transfers control
//      via swtch back to the scheduler.
void
scheduler(void)
{
801047d3:	55                   	push   %ebp
801047d4:	89 e5                	mov    %esp,%ebp
801047d6:	83 ec 28             	sub    $0x28,%esp
	struct proc *p;
	int sz=0;
801047d9:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
	for(;;){
		// Enable interrupts on this processor.
		sti();
801047e0:	e8 ca f8 ff ff       	call   801040af <sti>

		// Loop over process table looking for process to run.
		acquire(&ptable.lock);
801047e5:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
801047ec:	e8 16 14 00 00       	call   80105c07 <acquire>
		for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801047f1:	c7 45 f4 f4 29 11 80 	movl   $0x801129f4,-0xc(%ebp)
801047f8:	e9 a6 00 00 00       	jmp    801048a3 <scheduler+0xd0>
			if(p->state != RUNNABLE)
801047fd:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104800:	8b 40 0c             	mov    0xc(%eax),%eax
80104803:	83 f8 03             	cmp    $0x3,%eax
80104806:	0f 85 8f 00 00 00    	jne    8010489b <scheduler+0xc8>

			// Switch to chosen process.  It is the process's job
			// to release ptable.lock and then reacquire it
			// before jumping back to us.

			proc = p;
8010480c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010480f:	65 a3 04 00 00 00    	mov    %eax,%gs:0x4
			switchuvm(p);
80104815:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104818:	89 04 24             	mov    %eax,(%esp)
8010481b:	e8 9c 43 00 00       	call   80108bbc <switchuvm>
			p->state = RUNNING;
80104820:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104823:	c7 40 0c 04 00 00 00 	movl   $0x4,0xc(%eax)
			swtch(&cpu->scheduler, proc->context);
8010482a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104830:	8b 40 1c             	mov    0x1c(%eax),%eax
80104833:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
8010483a:	83 c2 04             	add    $0x4,%edx
8010483d:	89 44 24 04          	mov    %eax,0x4(%esp)
80104841:	89 14 24             	mov    %edx,(%esp)
80104844:	e8 bf 18 00 00       	call   80106108 <swtch>
			switchkvm();
80104849:	e8 51 43 00 00       	call   80108b9f <switchkvm>
			if(p->state == SLEEPING_SUSPENDED)
8010484e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104851:	8b 40 0c             	mov    0xc(%eax),%eax
80104854:	83 f8 06             	cmp    $0x6,%eax
80104857:	75 35                	jne    8010488e <scheduler+0xbb>
			{
				sz = proc->sz;
80104859:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010485f:	8b 00                	mov    (%eax),%eax
80104861:	89 45 f0             	mov    %eax,-0x10(%ebp)
				deallocuvm(p->pgdir, p->sz, 0);
80104864:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104867:	8b 10                	mov    (%eax),%edx
80104869:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010486c:	8b 40 04             	mov    0x4(%eax),%eax
8010486f:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80104876:	00 
80104877:	89 54 24 04          	mov    %edx,0x4(%esp)
8010487b:	89 04 24             	mov    %eax,(%esp)
8010487e:	e8 f4 46 00 00       	call   80108f77 <deallocuvm>
				proc->sz = sz;
80104883:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104889:	8b 55 f0             	mov    -0x10(%ebp),%edx
8010488c:	89 10                	mov    %edx,(%eax)
			}
			// Process is done running for now.
			// It should have changed its p->state before coming back.
			proc = 0;
8010488e:	65 c7 05 04 00 00 00 	movl   $0x0,%gs:0x4
80104895:	00 00 00 00 
80104899:	eb 01                	jmp    8010489c <scheduler+0xc9>

		// Loop over process table looking for process to run.
		acquire(&ptable.lock);
		for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
			if(p->state != RUNNABLE)
				continue;
8010489b:	90                   	nop
		// Enable interrupts on this processor.
		sti();

		// Loop over process table looking for process to run.
		acquire(&ptable.lock);
		for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010489c:	81 45 f4 20 01 00 00 	addl   $0x120,-0xc(%ebp)
801048a3:	81 7d f4 f4 71 11 80 	cmpl   $0x801171f4,-0xc(%ebp)
801048aa:	0f 82 4d ff ff ff    	jb     801047fd <scheduler+0x2a>
			}
			// Process is done running for now.
			// It should have changed its p->state before coming back.
			proc = 0;
		}
		release(&ptable.lock);
801048b0:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
801048b7:	e8 ad 13 00 00       	call   80105c69 <release>

	}
801048bc:	e9 1f ff ff ff       	jmp    801047e0 <scheduler+0xd>

801048c1 <sched>:

// Enter scheduler.  Must hold only ptable.lock
// and have changed proc->state.
void
sched(void)
{
801048c1:	55                   	push   %ebp
801048c2:	89 e5                	mov    %esp,%ebp
801048c4:	83 ec 28             	sub    $0x28,%esp
	int intena;

	if(!holding(&ptable.lock))
801048c7:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
801048ce:	e8 5e 14 00 00       	call   80105d31 <holding>
801048d3:	85 c0                	test   %eax,%eax
801048d5:	75 0c                	jne    801048e3 <sched+0x22>
		panic("sched ptable.lock");
801048d7:	c7 04 24 5d 96 10 80 	movl   $0x8010965d,(%esp)
801048de:	e8 4f bc ff ff       	call   80100532 <panic>
	if(cpu->ncli != 1)
801048e3:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801048e9:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
801048ef:	83 f8 01             	cmp    $0x1,%eax
801048f2:	74 0c                	je     80104900 <sched+0x3f>
		panic("sched locks");
801048f4:	c7 04 24 6f 96 10 80 	movl   $0x8010966f,(%esp)
801048fb:	e8 32 bc ff ff       	call   80100532 <panic>
	if(proc->state == RUNNING)
80104900:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104906:	8b 40 0c             	mov    0xc(%eax),%eax
80104909:	83 f8 04             	cmp    $0x4,%eax
8010490c:	75 0c                	jne    8010491a <sched+0x59>
		panic("sched running");
8010490e:	c7 04 24 7b 96 10 80 	movl   $0x8010967b,(%esp)
80104915:	e8 18 bc ff ff       	call   80100532 <panic>
	if(readeflags()&FL_IF)
8010491a:	e8 7b f7 ff ff       	call   8010409a <readeflags>
8010491f:	25 00 02 00 00       	and    $0x200,%eax
80104924:	85 c0                	test   %eax,%eax
80104926:	74 0c                	je     80104934 <sched+0x73>
		panic("sched interruptible");
80104928:	c7 04 24 89 96 10 80 	movl   $0x80109689,(%esp)
8010492f:	e8 fe bb ff ff       	call   80100532 <panic>
	intena = cpu->intena;
80104934:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010493a:	8b 80 b0 00 00 00    	mov    0xb0(%eax),%eax
80104940:	89 45 f4             	mov    %eax,-0xc(%ebp)
	swtch(&proc->context, cpu->scheduler);
80104943:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104949:	8b 40 04             	mov    0x4(%eax),%eax
8010494c:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
80104953:	83 c2 1c             	add    $0x1c,%edx
80104956:	89 44 24 04          	mov    %eax,0x4(%esp)
8010495a:	89 14 24             	mov    %edx,(%esp)
8010495d:	e8 a6 17 00 00       	call   80106108 <swtch>
	cpu->intena = intena;
80104962:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80104968:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010496b:	89 90 b0 00 00 00    	mov    %edx,0xb0(%eax)
}
80104971:	c9                   	leave  
80104972:	c3                   	ret    

80104973 <yield>:

// Give up the CPU for one scheduling round.
void
yield(void)
{
80104973:	55                   	push   %ebp
80104974:	89 e5                	mov    %esp,%ebp
80104976:	83 ec 18             	sub    $0x18,%esp
	acquire(&ptable.lock);  //DOC: yieldlock
80104979:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104980:	e8 82 12 00 00       	call   80105c07 <acquire>
	proc->state = RUNNABLE;
80104985:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010498b:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
	sched();
80104992:	e8 2a ff ff ff       	call   801048c1 <sched>
	release(&ptable.lock);
80104997:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
8010499e:	e8 c6 12 00 00       	call   80105c69 <release>
}
801049a3:	c9                   	leave  
801049a4:	c3                   	ret    

801049a5 <forkret>:

// A fork child's very first scheduling by scheduler()
// will swtch here.  "Return" to user space.
void
forkret(void)
{
801049a5:	55                   	push   %ebp
801049a6:	89 e5                	mov    %esp,%ebp
801049a8:	83 ec 18             	sub    $0x18,%esp
	static int first = 1;
	// Still holding ptable.lock from scheduler.
	release(&ptable.lock);
801049ab:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
801049b2:	e8 b2 12 00 00       	call   80105c69 <release>

	if (first) {
801049b7:	a1 60 c0 10 80       	mov    0x8010c060,%eax
801049bc:	85 c0                	test   %eax,%eax
801049be:	74 0f                	je     801049cf <forkret+0x2a>
		// Some initialization functions must be run in the context
		// of a regular process (e.g., they call sleep), and thus cannot
		// be run from main().
		first = 0;
801049c0:	c7 05 60 c0 10 80 00 	movl   $0x0,0x8010c060
801049c7:	00 00 00 
		initlog();
801049ca:	e8 ad e6 ff ff       	call   8010307c <initlog>
	}

	// Return to "caller", actually trapret (see allocproc).
}
801049cf:	c9                   	leave  
801049d0:	c3                   	ret    

801049d1 <sleep>:

// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
801049d1:	55                   	push   %ebp
801049d2:	89 e5                	mov    %esp,%ebp
801049d4:	83 ec 28             	sub    $0x28,%esp
	char fileName[10];//to save the file name
	if(proc == 0)
801049d7:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801049dd:	85 c0                	test   %eax,%eax
801049df:	75 0c                	jne    801049ed <sleep+0x1c>
		panic("sleep");
801049e1:	c7 04 24 9d 96 10 80 	movl   $0x8010969d,(%esp)
801049e8:	e8 45 bb ff ff       	call   80100532 <panic>

	if(lk == 0)
801049ed:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
801049f1:	75 0c                	jne    801049ff <sleep+0x2e>
		panic("sleep without lk");
801049f3:	c7 04 24 a3 96 10 80 	movl   $0x801096a3,(%esp)
801049fa:	e8 33 bb ff ff       	call   80100532 <panic>
	// change p->state and then call sched.
	// Once we hold ptable.lock, we can be
	// guaranteed that we won't miss any wakeup
	// (wakeup runs with ptable.lock locked),
	// so it's okay to release lk.
	if(lk != &ptable.lock){  //DOC: sleeplock0
801049ff:	81 7d 0c c0 29 11 80 	cmpl   $0x801129c0,0xc(%ebp)
80104a06:	74 17                	je     80104a1f <sleep+0x4e>
		acquire(&ptable.lock);  //DOC: sleeplock1
80104a08:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104a0f:	e8 f3 11 00 00       	call   80105c07 <acquire>
		release(lk);
80104a14:	8b 45 0c             	mov    0xc(%ebp),%eax
80104a17:	89 04 24             	mov    %eax,(%esp)
80104a1a:	e8 4a 12 00 00       	call   80105c69 <release>
	}

	// Go to sleep.
	proc->chan = chan;
80104a1f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104a25:	8b 55 08             	mov    0x8(%ebp),%edx
80104a28:	89 50 20             	mov    %edx,0x20(%eax)
	proc->state = SLEEPING;
80104a2b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104a31:	c7 40 0c 02 00 00 00 	movl   $0x2,0xc(%eax)
	//	cprintf(" name: %d, pid:  <%d>  \n",proc->name,proc->pid);
	if((proc->pid!=2) && (swapFlag == 1)){
80104a38:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104a3e:	8b 40 10             	mov    0x10(%eax),%eax
80104a41:	83 f8 02             	cmp    $0x2,%eax
80104a44:	74 2d                	je     80104a73 <sleep+0xa2>
80104a46:	a1 a8 c6 10 80       	mov    0x8010c6a8,%eax
80104a4b:	83 f8 01             	cmp    $0x1,%eax
80104a4e:	75 23                	jne    80104a73 <sleep+0xa2>

		release(&ptable.lock);
80104a50:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104a57:	e8 0d 12 00 00       	call   80105c69 <release>
		//swap out process
		swapOut(fileName);
80104a5c:	8d 45 ee             	lea    -0x12(%ebp),%eax
80104a5f:	89 04 24             	mov    %eax,(%esp)
80104a62:	e8 d9 10 00 00       	call   80105b40 <swapOut>
		acquire(&ptable.lock);
80104a67:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104a6e:	e8 94 11 00 00       	call   80105c07 <acquire>
	}
	sched();
80104a73:	e8 49 fe ff ff       	call   801048c1 <sched>

	// Tidy up.
	proc->chan = 0;
80104a78:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104a7e:	c7 40 20 00 00 00 00 	movl   $0x0,0x20(%eax)

	// Reacquire original lock.
	if(lk != &ptable.lock){  //DOC: sleeplock2
80104a85:	81 7d 0c c0 29 11 80 	cmpl   $0x801129c0,0xc(%ebp)
80104a8c:	74 17                	je     80104aa5 <sleep+0xd4>
		release(&ptable.lock);
80104a8e:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104a95:	e8 cf 11 00 00       	call   80105c69 <release>
		acquire(lk);
80104a9a:	8b 45 0c             	mov    0xc(%ebp),%eax
80104a9d:	89 04 24             	mov    %eax,(%esp)
80104aa0:	e8 62 11 00 00       	call   80105c07 <acquire>
	}
}
80104aa5:	c9                   	leave  
80104aa6:	c3                   	ret    

80104aa7 <wakeup1>:
//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan)
{
80104aa7:	55                   	push   %ebp
80104aa8:	89 e5                	mov    %esp,%ebp
80104aaa:	83 ec 28             	sub    $0x28,%esp
	struct proc *p;

	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104aad:	c7 45 f4 f4 29 11 80 	movl   $0x801129f4,-0xc(%ebp)
80104ab4:	eb 54                	jmp    80104b0a <wakeup1+0x63>
	{
		if(p->state == SLEEPING_SUSPENDED && p->chan == chan)
80104ab6:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104ab9:	8b 40 0c             	mov    0xc(%eax),%eax
80104abc:	83 f8 06             	cmp    $0x6,%eax
80104abf:	75 22                	jne    80104ae3 <wakeup1+0x3c>
80104ac1:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104ac4:	8b 40 20             	mov    0x20(%eax),%eax
80104ac7:	3b 45 08             	cmp    0x8(%ebp),%eax
80104aca:	75 17                	jne    80104ae3 <wakeup1+0x3c>
		{

			p->state = RUNNABLE_SUSPENDED;
80104acc:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104acf:	c7 40 0c 07 00 00 00 	movl   $0x7,0xc(%eax)
			wakeup1(inSwapperProc);
80104ad6:	a1 b4 c6 10 80       	mov    0x8010c6b4,%eax
80104adb:	89 04 24             	mov    %eax,(%esp)
80104ade:	e8 c4 ff ff ff       	call   80104aa7 <wakeup1>

		}
		if(p->state == SLEEPING && p->chan == chan)
80104ae3:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104ae6:	8b 40 0c             	mov    0xc(%eax),%eax
80104ae9:	83 f8 02             	cmp    $0x2,%eax
80104aec:	75 15                	jne    80104b03 <wakeup1+0x5c>
80104aee:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104af1:	8b 40 20             	mov    0x20(%eax),%eax
80104af4:	3b 45 08             	cmp    0x8(%ebp),%eax
80104af7:	75 0a                	jne    80104b03 <wakeup1+0x5c>
		{
			p->state = RUNNABLE;
80104af9:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104afc:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
	struct proc *p;

	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104b03:	81 45 f4 20 01 00 00 	addl   $0x120,-0xc(%ebp)
80104b0a:	81 7d f4 f4 71 11 80 	cmpl   $0x801171f4,-0xc(%ebp)
80104b11:	72 a3                	jb     80104ab6 <wakeup1+0xf>
		if(p->state == SLEEPING && p->chan == chan)
		{
			p->state = RUNNABLE;
		}
	}
}
80104b13:	c9                   	leave  
80104b14:	c3                   	ret    

80104b15 <wakeup>:

// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80104b15:	55                   	push   %ebp
80104b16:	89 e5                	mov    %esp,%ebp
80104b18:	83 ec 18             	sub    $0x18,%esp
	acquire(&ptable.lock);
80104b1b:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104b22:	e8 e0 10 00 00       	call   80105c07 <acquire>
	wakeup1(chan);
80104b27:	8b 45 08             	mov    0x8(%ebp),%eax
80104b2a:	89 04 24             	mov    %eax,(%esp)
80104b2d:	e8 75 ff ff ff       	call   80104aa7 <wakeup1>
	release(&ptable.lock);
80104b32:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104b39:	e8 2b 11 00 00       	call   80105c69 <release>
}
80104b3e:	c9                   	leave  
80104b3f:	c3                   	ret    

80104b40 <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
80104b40:	55                   	push   %ebp
80104b41:	89 e5                	mov    %esp,%ebp
80104b43:	83 ec 28             	sub    $0x28,%esp
	struct proc *p;

	acquire(&ptable.lock);
80104b46:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104b4d:	e8 b5 10 00 00       	call   80105c07 <acquire>
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104b52:	c7 45 f4 f4 29 11 80 	movl   $0x801129f4,-0xc(%ebp)
80104b59:	eb 44                	jmp    80104b9f <kill+0x5f>
		if(p->pid == pid){
80104b5b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b5e:	8b 40 10             	mov    0x10(%eax),%eax
80104b61:	3b 45 08             	cmp    0x8(%ebp),%eax
80104b64:	75 32                	jne    80104b98 <kill+0x58>
			p->killed = 1;
80104b66:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b69:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
			// Wake process from sleep if necessary.
			if(p->state == SLEEPING)
80104b70:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b73:	8b 40 0c             	mov    0xc(%eax),%eax
80104b76:	83 f8 02             	cmp    $0x2,%eax
80104b79:	75 0a                	jne    80104b85 <kill+0x45>
				p->state = RUNNABLE;
80104b7b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b7e:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
			release(&ptable.lock);
80104b85:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104b8c:	e8 d8 10 00 00       	call   80105c69 <release>
			return 0;
80104b91:	b8 00 00 00 00       	mov    $0x0,%eax
80104b96:	eb 21                	jmp    80104bb9 <kill+0x79>
kill(int pid)
{
	struct proc *p;

	acquire(&ptable.lock);
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104b98:	81 45 f4 20 01 00 00 	addl   $0x120,-0xc(%ebp)
80104b9f:	81 7d f4 f4 71 11 80 	cmpl   $0x801171f4,-0xc(%ebp)
80104ba6:	72 b3                	jb     80104b5b <kill+0x1b>
				p->state = RUNNABLE;
			release(&ptable.lock);
			return 0;
		}
	}
	release(&ptable.lock);
80104ba8:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104baf:	e8 b5 10 00 00       	call   80105c69 <release>
	return -1;
80104bb4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80104bb9:	c9                   	leave  
80104bba:	c3                   	ret    

80104bbb <procdump>:
// Print a process listing to console.  For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
80104bbb:	55                   	push   %ebp
80104bbc:	89 e5                	mov    %esp,%ebp
80104bbe:	83 ec 58             	sub    $0x58,%esp
	int i;
	struct proc *p;
	char *state;
	uint pc[10];

	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104bc1:	c7 45 f0 f4 29 11 80 	movl   $0x801129f4,-0x10(%ebp)
80104bc8:	e9 db 00 00 00       	jmp    80104ca8 <procdump+0xed>
		if(p->state == UNUSED)
80104bcd:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104bd0:	8b 40 0c             	mov    0xc(%eax),%eax
80104bd3:	85 c0                	test   %eax,%eax
80104bd5:	0f 84 c5 00 00 00    	je     80104ca0 <procdump+0xe5>
			continue;
		if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80104bdb:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104bde:	8b 40 0c             	mov    0xc(%eax),%eax
80104be1:	83 f8 07             	cmp    $0x7,%eax
80104be4:	77 23                	ja     80104c09 <procdump+0x4e>
80104be6:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104be9:	8b 40 0c             	mov    0xc(%eax),%eax
80104bec:	8b 04 85 40 c0 10 80 	mov    -0x7fef3fc0(,%eax,4),%eax
80104bf3:	85 c0                	test   %eax,%eax
80104bf5:	74 12                	je     80104c09 <procdump+0x4e>
			state = states[p->state];
80104bf7:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104bfa:	8b 40 0c             	mov    0xc(%eax),%eax
80104bfd:	8b 04 85 40 c0 10 80 	mov    -0x7fef3fc0(,%eax,4),%eax
80104c04:	89 45 ec             	mov    %eax,-0x14(%ebp)
80104c07:	eb 07                	jmp    80104c10 <procdump+0x55>
		else
			state = "???";
80104c09:	c7 45 ec b4 96 10 80 	movl   $0x801096b4,-0x14(%ebp)
		cprintf("%d %s %s", p->pid, state, p->name);
80104c10:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104c13:	8d 50 6c             	lea    0x6c(%eax),%edx
80104c16:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104c19:	8b 40 10             	mov    0x10(%eax),%eax
80104c1c:	89 54 24 0c          	mov    %edx,0xc(%esp)
80104c20:	8b 55 ec             	mov    -0x14(%ebp),%edx
80104c23:	89 54 24 08          	mov    %edx,0x8(%esp)
80104c27:	89 44 24 04          	mov    %eax,0x4(%esp)
80104c2b:	c7 04 24 b8 96 10 80 	movl   $0x801096b8,(%esp)
80104c32:	e8 5f b7 ff ff       	call   80100396 <cprintf>
		if(p->state == SLEEPING){
80104c37:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104c3a:	8b 40 0c             	mov    0xc(%eax),%eax
80104c3d:	83 f8 02             	cmp    $0x2,%eax
80104c40:	75 50                	jne    80104c92 <procdump+0xd7>
			getcallerpcs((uint*)p->context->ebp+2, pc);
80104c42:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104c45:	8b 40 1c             	mov    0x1c(%eax),%eax
80104c48:	8b 40 0c             	mov    0xc(%eax),%eax
80104c4b:	83 c0 08             	add    $0x8,%eax
80104c4e:	8d 55 c4             	lea    -0x3c(%ebp),%edx
80104c51:	89 54 24 04          	mov    %edx,0x4(%esp)
80104c55:	89 04 24             	mov    %eax,(%esp)
80104c58:	e8 5b 10 00 00       	call   80105cb8 <getcallerpcs>
			for(i=0; i<10 && pc[i] != 0; i++)
80104c5d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104c64:	eb 1b                	jmp    80104c81 <procdump+0xc6>
				cprintf(" %p", pc[i]);
80104c66:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104c69:	8b 44 85 c4          	mov    -0x3c(%ebp,%eax,4),%eax
80104c6d:	89 44 24 04          	mov    %eax,0x4(%esp)
80104c71:	c7 04 24 c1 96 10 80 	movl   $0x801096c1,(%esp)
80104c78:	e8 19 b7 ff ff       	call   80100396 <cprintf>
		else
			state = "???";
		cprintf("%d %s %s", p->pid, state, p->name);
		if(p->state == SLEEPING){
			getcallerpcs((uint*)p->context->ebp+2, pc);
			for(i=0; i<10 && pc[i] != 0; i++)
80104c7d:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80104c81:	83 7d f4 09          	cmpl   $0x9,-0xc(%ebp)
80104c85:	7f 0b                	jg     80104c92 <procdump+0xd7>
80104c87:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104c8a:	8b 44 85 c4          	mov    -0x3c(%ebp,%eax,4),%eax
80104c8e:	85 c0                	test   %eax,%eax
80104c90:	75 d4                	jne    80104c66 <procdump+0xab>
				cprintf(" %p", pc[i]);
		}
		cprintf("\n");
80104c92:	c7 04 24 c5 96 10 80 	movl   $0x801096c5,(%esp)
80104c99:	e8 f8 b6 ff ff       	call   80100396 <cprintf>
80104c9e:	eb 01                	jmp    80104ca1 <procdump+0xe6>
	char *state;
	uint pc[10];

	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
		if(p->state == UNUSED)
			continue;
80104ca0:	90                   	nop
	int i;
	struct proc *p;
	char *state;
	uint pc[10];

	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104ca1:	81 45 f0 20 01 00 00 	addl   $0x120,-0x10(%ebp)
80104ca8:	81 7d f0 f4 71 11 80 	cmpl   $0x801171f4,-0x10(%ebp)
80104caf:	0f 82 18 ff ff ff    	jb     80104bcd <procdump+0x12>
			for(i=0; i<10 && pc[i] != 0; i++)
				cprintf(" %p", pc[i]);
		}
		cprintf("\n");
	}
}
80104cb5:	c9                   	leave  
80104cb6:	c3                   	ret    

80104cb7 <createInternalProcess>:
//------------------------------ TASK 1 ----------------------


//This method open a new process that taking care of the Runnable suspend processes
void createInternalProcess(const char *name,void (*entrypoint)())
{
80104cb7:	55                   	push   %ebp
80104cb8:	89 e5                	mov    %esp,%ebp
80104cba:	57                   	push   %edi
80104cbb:	56                   	push   %esi
80104cbc:	53                   	push   %ebx
80104cbd:	83 ec 2c             	sub    $0x2c,%esp
	int i;
	// Allocate process.
	inSwapperProc = allocproc();
80104cc0:	e8 0c f4 ff ff       	call   801040d1 <allocproc>
80104cc5:	a3 b4 c6 10 80       	mov    %eax,0x8010c6b4

	// Copy process state from p.
	inSwapperProc->pgdir = copyuvm(initproc->pgdir, initproc->sz);
80104cca:	8b 1d b4 c6 10 80    	mov    0x8010c6b4,%ebx
80104cd0:	a1 b0 c6 10 80       	mov    0x8010c6b0,%eax
80104cd5:	8b 10                	mov    (%eax),%edx
80104cd7:	a1 b0 c6 10 80       	mov    0x8010c6b0,%eax
80104cdc:	8b 40 04             	mov    0x4(%eax),%eax
80104cdf:	89 54 24 04          	mov    %edx,0x4(%esp)
80104ce3:	89 04 24             	mov    %eax,(%esp)
80104ce6:	e8 28 44 00 00       	call   80109113 <copyuvm>
80104ceb:	89 43 04             	mov    %eax,0x4(%ebx)
	inSwapperProc->sz = initproc->sz;
80104cee:	a1 b4 c6 10 80       	mov    0x8010c6b4,%eax
80104cf3:	8b 15 b0 c6 10 80    	mov    0x8010c6b0,%edx
80104cf9:	8b 12                	mov    (%edx),%edx
80104cfb:	89 10                	mov    %edx,(%eax)
	inSwapperProc->parent = initproc;
80104cfd:	a1 b4 c6 10 80       	mov    0x8010c6b4,%eax
80104d02:	8b 15 b0 c6 10 80    	mov    0x8010c6b0,%edx
80104d08:	89 50 14             	mov    %edx,0x14(%eax)
	*inSwapperProc->tf = *initproc->tf;
80104d0b:	a1 b4 c6 10 80       	mov    0x8010c6b4,%eax
80104d10:	8b 50 18             	mov    0x18(%eax),%edx
80104d13:	a1 b0 c6 10 80       	mov    0x8010c6b0,%eax
80104d18:	8b 40 18             	mov    0x18(%eax),%eax
80104d1b:	89 c3                	mov    %eax,%ebx
80104d1d:	b8 13 00 00 00       	mov    $0x13,%eax
80104d22:	89 d7                	mov    %edx,%edi
80104d24:	89 de                	mov    %ebx,%esi
80104d26:	89 c1                	mov    %eax,%ecx
80104d28:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)

	// Clear %eax so that fork returns 0 in the child.
	inSwapperProc->tf->eax = 0;
80104d2a:	a1 b4 c6 10 80       	mov    0x8010c6b4,%eax
80104d2f:	8b 40 18             	mov    0x18(%eax),%eax
80104d32:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
	inSwapperProc->context->eip = (uint) entrypoint;
80104d39:	a1 b4 c6 10 80       	mov    0x8010c6b4,%eax
80104d3e:	8b 40 1c             	mov    0x1c(%eax),%eax
80104d41:	8b 55 0c             	mov    0xc(%ebp),%edx
80104d44:	89 50 10             	mov    %edx,0x10(%eax)
	inSwapperProc->tf->eip = (int) entrypoint;
80104d47:	a1 b4 c6 10 80       	mov    0x8010c6b4,%eax
80104d4c:	8b 40 18             	mov    0x18(%eax),%eax
80104d4f:	8b 55 0c             	mov    0xc(%ebp),%edx
80104d52:	89 50 38             	mov    %edx,0x38(%eax)

	for(i = 0; i < NOFILE; i++)
80104d55:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
80104d5c:	eb 3e                	jmp    80104d9c <createInternalProcess+0xe5>
		if(initproc->ofile[i])
80104d5e:	a1 b0 c6 10 80       	mov    0x8010c6b0,%eax
80104d63:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80104d66:	83 c2 08             	add    $0x8,%edx
80104d69:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
80104d6d:	85 c0                	test   %eax,%eax
80104d6f:	74 27                	je     80104d98 <createInternalProcess+0xe1>
			inSwapperProc->ofile[i] = filedup(initproc->ofile[i]);
80104d71:	8b 1d b4 c6 10 80    	mov    0x8010c6b4,%ebx
80104d77:	a1 b0 c6 10 80       	mov    0x8010c6b0,%eax
80104d7c:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80104d7f:	83 c2 08             	add    $0x8,%edx
80104d82:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
80104d86:	89 04 24             	mov    %eax,(%esp)
80104d89:	e8 02 c2 ff ff       	call   80100f90 <filedup>
80104d8e:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80104d91:	83 c2 08             	add    $0x8,%edx
80104d94:	89 44 93 08          	mov    %eax,0x8(%ebx,%edx,4)
	// Clear %eax so that fork returns 0 in the child.
	inSwapperProc->tf->eax = 0;
	inSwapperProc->context->eip = (uint) entrypoint;
	inSwapperProc->tf->eip = (int) entrypoint;

	for(i = 0; i < NOFILE; i++)
80104d98:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
80104d9c:	83 7d e4 0f          	cmpl   $0xf,-0x1c(%ebp)
80104da0:	7e bc                	jle    80104d5e <createInternalProcess+0xa7>
		if(initproc->ofile[i])
			inSwapperProc->ofile[i] = filedup(initproc->ofile[i]);

	inSwapperProc->cwd = idup(initproc->cwd);
80104da2:	8b 1d b4 c6 10 80    	mov    0x8010c6b4,%ebx
80104da8:	a1 b0 c6 10 80       	mov    0x8010c6b0,%eax
80104dad:	8b 40 68             	mov    0x68(%eax),%eax
80104db0:	89 04 24             	mov    %eax,(%esp)
80104db3:	e8 96 ca ff ff       	call   8010184e <idup>
80104db8:	89 43 68             	mov    %eax,0x68(%ebx)
	inSwapperProc->state = RUNNABLE;
80104dbb:	a1 b4 c6 10 80       	mov    0x8010c6b4,%eax
80104dc0:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
	safestrcpy(inSwapperProc->name, IN_SWAPPER, strlen(IN_SWAPPER));
80104dc7:	c7 04 24 c7 96 10 80 	movl   $0x801096c7,(%esp)
80104dce:	e8 0d 13 00 00       	call   801060e0 <strlen>
80104dd3:	8b 15 b4 c6 10 80    	mov    0x8010c6b4,%edx
80104dd9:	83 c2 6c             	add    $0x6c,%edx
80104ddc:	89 44 24 08          	mov    %eax,0x8(%esp)
80104de0:	c7 44 24 04 c7 96 10 	movl   $0x801096c7,0x4(%esp)
80104de7:	80 
80104de8:	89 14 24             	mov    %edx,(%esp)
80104deb:	e8 a2 12 00 00       	call   80106092 <safestrcpy>
}
80104df0:	83 c4 2c             	add    $0x2c,%esp
80104df3:	5b                   	pop    %ebx
80104df4:	5e                   	pop    %esi
80104df5:	5f                   	pop    %edi
80104df6:	5d                   	pop    %ebp
80104df7:	c3                   	ret    

80104df8 <swap_in>:

void swap_in(char fname[10], int openFlags, struct proc* p) {
80104df8:	55                   	push   %ebp
80104df9:	89 e5                	mov    %esp,%ebp
80104dfb:	83 ec 38             	sub    $0x38,%esp
	struct file* f;
	itoa(p->pid, fname); //get file to open name
80104dfe:	8b 45 10             	mov    0x10(%ebp),%eax
80104e01:	8b 40 10             	mov    0x10(%eax),%eax
80104e04:	8b 55 08             	mov    0x8(%ebp),%edx
80104e07:	89 54 24 04          	mov    %edx,0x4(%esp)
80104e0b:	89 04 24             	mov    %eax,(%esp)
80104e0e:	e8 01 0a 00 00       	call   80105814 <itoa>
	f = openFile(fname, openFlags);
80104e13:	8b 45 0c             	mov    0xc(%ebp),%eax
80104e16:	89 44 24 04          	mov    %eax,0x4(%esp)
80104e1a:	8b 45 08             	mov    0x8(%ebp),%eax
80104e1d:	89 04 24             	mov    %eax,(%esp)
80104e20:	e8 9e 05 00 00       	call   801053c3 <openFile>
80104e25:	89 45 f4             	mov    %eax,-0xc(%ebp)
	loaduvm(p->pgdir, 0, f->ip, 0, p->sz); //load files
80104e28:	8b 45 10             	mov    0x10(%ebp),%eax
80104e2b:	8b 08                	mov    (%eax),%ecx
80104e2d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104e30:	8b 50 10             	mov    0x10(%eax),%edx
80104e33:	8b 45 10             	mov    0x10(%ebp),%eax
80104e36:	8b 40 04             	mov    0x4(%eax),%eax
80104e39:	89 4c 24 10          	mov    %ecx,0x10(%esp)
80104e3d:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
80104e44:	00 
80104e45:	89 54 24 08          	mov    %edx,0x8(%esp)
80104e49:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80104e50:	00 
80104e51:	89 04 24             	mov    %eax,(%esp)
80104e54:	e8 55 3f 00 00       	call   80108dae <loaduvm>
	fileclose(f);
80104e59:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104e5c:	89 04 24             	mov    %eax,(%esp)
80104e5f:	e8 74 c1 ff ff       	call   80100fd8 <fileclose>
	unlink(fname); //delete file
80104e64:	8b 45 08             	mov    0x8(%ebp),%eax
80104e67:	89 04 24             	mov    %eax,(%esp)
80104e6a:	e8 5f 06 00 00       	call   801054ce <unlink>
}
80104e6f:	c9                   	leave  
80104e70:	c3                   	ret    

80104e71 <inSwapper>:

void inSwapper()
{
80104e71:	55                   	push   %ebp
80104e72:	89 e5                	mov    %esp,%ebp
80104e74:	83 ec 38             	sub    $0x38,%esp
	struct proc* p;
	char fname[10];
	int openFlags = {0};	//openFile get int flags
80104e77:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
	for(;;)
	{
		for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){	//looking for RUNNABLE_SUSPENDED proc
80104e7e:	c7 45 f4 f4 29 11 80 	movl   $0x801129f4,-0xc(%ebp)
80104e85:	eb 6c                	jmp    80104ef3 <inSwapper+0x82>
			if(p->state == RUNNABLE_SUSPENDED)
80104e87:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104e8a:	8b 40 0c             	mov    0xc(%eax),%eax
80104e8d:	83 f8 07             	cmp    $0x7,%eax
80104e90:	75 5a                	jne    80104eec <inSwapper+0x7b>
			{

				allocuvm(p->pgdir, 0, p->sz); //allocate
80104e92:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104e95:	8b 10                	mov    (%eax),%edx
80104e97:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104e9a:	8b 40 04             	mov    0x4(%eax),%eax
80104e9d:	89 54 24 08          	mov    %edx,0x8(%esp)
80104ea1:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80104ea8:	00 
80104ea9:	89 04 24             	mov    %eax,(%esp)
80104eac:	e8 ec 3f 00 00       	call   80108e9d <allocuvm>
				release(&ptable.lock); //scheduler do acquire b4 running proc
80104eb1:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104eb8:	e8 ac 0d 00 00       	call   80105c69 <release>
				swap_in(fname, openFlags, p);
80104ebd:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104ec0:	89 44 24 08          	mov    %eax,0x8(%esp)
80104ec4:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104ec7:	89 44 24 04          	mov    %eax,0x4(%esp)
80104ecb:	8d 45 e6             	lea    -0x1a(%ebp),%eax
80104ece:	89 04 24             	mov    %eax,(%esp)
80104ed1:	e8 22 ff ff ff       	call   80104df8 <swap_in>
				acquire(&ptable.lock);
80104ed6:	c7 04 24 c0 29 11 80 	movl   $0x801129c0,(%esp)
80104edd:	e8 25 0d 00 00       	call   80105c07 <acquire>

				p->state = RUNNABLE;
80104ee2:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104ee5:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
	struct proc* p;
	char fname[10];
	int openFlags = {0};	//openFile get int flags
	for(;;)
	{
		for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){	//looking for RUNNABLE_SUSPENDED proc
80104eec:	81 45 f4 20 01 00 00 	addl   $0x120,-0xc(%ebp)
80104ef3:	81 7d f4 f4 71 11 80 	cmpl   $0x801171f4,-0xc(%ebp)
80104efa:	72 8b                	jb     80104e87 <inSwapper+0x16>
				acquire(&ptable.lock);

				p->state = RUNNABLE;
			}
		}
		sleep(proc, &ptable.lock);
80104efc:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104f02:	c7 44 24 04 c0 29 11 	movl   $0x801129c0,0x4(%esp)
80104f09:	80 
80104f0a:	89 04 24             	mov    %eax,(%esp)
80104f0d:	e8 bf fa ff ff       	call   801049d1 <sleep>
	}
80104f12:	e9 67 ff ff ff       	jmp    80104e7e <inSwapper+0xd>

80104f17 <enableSwapping>:
}

int enableSwapping()
{
80104f17:	55                   	push   %ebp
80104f18:	89 e5                	mov    %esp,%ebp
	return swapFlag = 1;
80104f1a:	c7 05 a8 c6 10 80 01 	movl   $0x1,0x8010c6a8
80104f21:	00 00 00 
80104f24:	a1 a8 c6 10 80       	mov    0x8010c6a8,%eax
}
80104f29:	5d                   	pop    %ebp
80104f2a:	c3                   	ret    

80104f2b <disableSwapping>:
int disableSwapping()
{
80104f2b:	55                   	push   %ebp
80104f2c:	89 e5                	mov    %esp,%ebp
	return swapFlag = 0;
80104f2e:	c7 05 a8 c6 10 80 00 	movl   $0x0,0x8010c6a8
80104f35:	00 00 00 
80104f38:	a1 a8 c6 10 80       	mov    0x8010c6a8,%eax
}
80104f3d:	5d                   	pop    %ebp
80104f3e:	c3                   	ret    

80104f3f <shmget>:


//returns the identifier of the shared memory segment associated with the
//value of the argument key.
int shmget(int key,uint size, int shmflg)
{
80104f3f:	55                   	push   %ebp
80104f40:	89 e5                	mov    %esp,%ebp
80104f42:	53                   	push   %ebx
80104f43:	83 ec 14             	sub    $0x14,%esp

	int i;
	if (shmflg == GET)
80104f46:	83 7d 10 02          	cmpl   $0x2,0x10(%ebp)
80104f4a:	75 3e                	jne    80104f8a <shmget+0x4b>
	{
		for (i = 0; i < nextSegId ; i++)
80104f4c:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104f53:	eb 21                	jmp    80104f76 <shmget+0x37>
			if(segArray[i].key == key)
80104f55:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104f58:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
80104f5e:	05 80 0f 11 80       	add    $0x80110f80,%eax
80104f63:	8b 00                	mov    (%eax),%eax
80104f65:	3b 45 08             	cmp    0x8(%ebp),%eax
80104f68:	75 08                	jne    80104f72 <shmget+0x33>
				return i;
80104f6a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104f6d:	e9 10 01 00 00       	jmp    80105082 <shmget+0x143>
{

	int i;
	if (shmflg == GET)
	{
		for (i = 0; i < nextSegId ; i++)
80104f72:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80104f76:	a1 ac c6 10 80       	mov    0x8010c6ac,%eax
80104f7b:	39 45 f4             	cmp    %eax,-0xc(%ebp)
80104f7e:	7c d5                	jl     80104f55 <shmget+0x16>
			if(segArray[i].key == key)
				return i;
		return -1;
80104f80:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104f85:	e9 f8 00 00 00       	jmp    80105082 <shmget+0x143>
	}

	if (shmflg == CREAT)
80104f8a:	83 7d 10 01          	cmpl   $0x1,0x10(%ebp)
80104f8e:	0f 85 e9 00 00 00    	jne    8010507d <shmget+0x13e>
	{
		for (i = 0; i<nextSegId ; i++)
80104f94:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104f9b:	eb 23                	jmp    80104fc0 <shmget+0x81>
			if(segArray[i].key == key)
80104f9d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104fa0:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
80104fa6:	05 80 0f 11 80       	add    $0x80110f80,%eax
80104fab:	8b 00                	mov    (%eax),%eax
80104fad:	3b 45 08             	cmp    0x8(%ebp),%eax
80104fb0:	75 0a                	jne    80104fbc <shmget+0x7d>
				return -1;
80104fb2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104fb7:	e9 c6 00 00 00       	jmp    80105082 <shmget+0x143>
		return -1;
	}

	if (shmflg == CREAT)
	{
		for (i = 0; i<nextSegId ; i++)
80104fbc:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80104fc0:	a1 ac c6 10 80       	mov    0x8010c6ac,%eax
80104fc5:	39 45 f4             	cmp    %eax,-0xc(%ebp)
80104fc8:	7c d3                	jl     80104f9d <shmget+0x5e>
			if(segArray[i].key == key)
				return -1;
		if (size % 4096  == 0)
80104fca:	8b 45 0c             	mov    0xc(%ebp),%eax
80104fcd:	25 ff 0f 00 00       	and    $0xfff,%eax
80104fd2:	85 c0                	test   %eax,%eax
80104fd4:	75 1d                	jne    80104ff3 <shmget+0xb4>
			segArray[nextSegId].numOfPages = size / 4096;	//num of pages(each size 4096)
80104fd6:	8b 15 ac c6 10 80    	mov    0x8010c6ac,%edx
80104fdc:	8b 45 0c             	mov    0xc(%ebp),%eax
80104fdf:	c1 e8 0c             	shr    $0xc,%eax
80104fe2:	69 d2 50 01 00 00    	imul   $0x150,%edx,%edx
80104fe8:	81 c2 c0 0f 11 80    	add    $0x80110fc0,%edx
80104fee:	89 42 08             	mov    %eax,0x8(%edx)
80104ff1:	eb 1e                	jmp    80105011 <shmget+0xd2>
		else
			segArray[nextSegId].numOfPages = size / 4096 + 1;	//add another page
80104ff3:	8b 15 ac c6 10 80    	mov    0x8010c6ac,%edx
80104ff9:	8b 45 0c             	mov    0xc(%ebp),%eax
80104ffc:	c1 e8 0c             	shr    $0xc,%eax
80104fff:	83 c0 01             	add    $0x1,%eax
80105002:	69 d2 50 01 00 00    	imul   $0x150,%edx,%edx
80105008:	81 c2 c0 0f 11 80    	add    $0x80110fc0,%edx
8010500e:	89 42 08             	mov    %eax,0x8(%edx)

		for (i=0 ; i < segArray[nextSegId].numOfPages ; i++)	//Allocate all pages
80105011:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80105018:	eb 1e                	jmp    80105038 <shmget+0xf9>
		{
			segArray[nextSegId].pages[i] = kalloc();
8010501a:	8b 1d ac c6 10 80    	mov    0x8010c6ac,%ebx
80105020:	e8 41 db ff ff       	call   80102b66 <kalloc>
80105025:	6b cb 54             	imul   $0x54,%ebx,%ecx
80105028:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010502b:	01 ca                	add    %ecx,%edx
8010502d:	89 04 95 84 0f 11 80 	mov    %eax,-0x7feef07c(,%edx,4)
		if (size % 4096  == 0)
			segArray[nextSegId].numOfPages = size / 4096;	//num of pages(each size 4096)
		else
			segArray[nextSegId].numOfPages = size / 4096 + 1;	//add another page

		for (i=0 ; i < segArray[nextSegId].numOfPages ; i++)	//Allocate all pages
80105034:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80105038:	a1 ac c6 10 80       	mov    0x8010c6ac,%eax
8010503d:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
80105043:	05 c0 0f 11 80       	add    $0x80110fc0,%eax
80105048:	8b 40 08             	mov    0x8(%eax),%eax
8010504b:	3b 45 f4             	cmp    -0xc(%ebp),%eax
8010504e:	7f ca                	jg     8010501a <shmget+0xdb>
		{
			segArray[nextSegId].pages[i] = kalloc();
		}
		segArray[nextSegId].key = key;
80105050:	a1 ac c6 10 80       	mov    0x8010c6ac,%eax
80105055:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
8010505b:	8d 90 80 0f 11 80    	lea    -0x7feef080(%eax),%edx
80105061:	8b 45 08             	mov    0x8(%ebp),%eax
80105064:	89 02                	mov    %eax,(%edx)
		nextSegId++;
80105066:	a1 ac c6 10 80       	mov    0x8010c6ac,%eax
8010506b:	83 c0 01             	add    $0x1,%eax
8010506e:	a3 ac c6 10 80       	mov    %eax,0x8010c6ac
		return nextSegId - 1;
80105073:	a1 ac c6 10 80       	mov    0x8010c6ac,%eax
80105078:	83 e8 01             	sub    $0x1,%eax
8010507b:	eb 05                	jmp    80105082 <shmget+0x143>
	}
	return -1;
8010507d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105082:	83 c4 14             	add    $0x14,%esp
80105085:	5b                   	pop    %ebx
80105086:	5d                   	pop    %ebp
80105087:	c3                   	ret    

80105088 <shmdel>:

//If the shared memory mapped to shmid is not linked to any other process, the kernel
//free the previously allocated frames and return the number of frames freed.
//Otherwise, it returns -1.v
int shmdel(int shmid)
{
80105088:	55                   	push   %ebp
80105089:	89 e5                	mov    %esp,%ebp
8010508b:	83 ec 28             	sub    $0x28,%esp
	int i;
	if (shmid > nextSegId)
8010508e:	a1 ac c6 10 80       	mov    0x8010c6ac,%eax
80105093:	39 45 08             	cmp    %eax,0x8(%ebp)
80105096:	7e 07                	jle    8010509f <shmdel+0x17>
		return -1;
80105098:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010509d:	eb 71                	jmp    80105110 <shmdel+0x88>
	else
		if (segArray[shmid].numOfProcs == 0)
8010509f:	8b 45 08             	mov    0x8(%ebp),%eax
801050a2:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
801050a8:	05 c0 10 11 80       	add    $0x801110c0,%eax
801050ad:	8b 40 0c             	mov    0xc(%eax),%eax
801050b0:	85 c0                	test   %eax,%eax
801050b2:	75 57                	jne    8010510b <shmdel+0x83>
		{
			for(i=0;i<segArray[shmid].numOfPages;i++)//free the memory
801050b4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801050bb:	eb 1e                	jmp    801050db <shmdel+0x53>
			{

				kfree(segArray[shmid].pages[i]);
801050bd:	8b 45 08             	mov    0x8(%ebp),%eax
801050c0:	6b d0 54             	imul   $0x54,%eax,%edx
801050c3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801050c6:	01 d0                	add    %edx,%eax
801050c8:	8b 04 85 84 0f 11 80 	mov    -0x7feef07c(,%eax,4),%eax
801050cf:	89 04 24             	mov    %eax,(%esp)
801050d2:	e8 9b d9 ff ff       	call   80102a72 <kfree>
	if (shmid > nextSegId)
		return -1;
	else
		if (segArray[shmid].numOfProcs == 0)
		{
			for(i=0;i<segArray[shmid].numOfPages;i++)//free the memory
801050d7:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801050db:	8b 45 08             	mov    0x8(%ebp),%eax
801050de:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
801050e4:	05 c0 0f 11 80       	add    $0x80110fc0,%eax
801050e9:	8b 40 08             	mov    0x8(%eax),%eax
801050ec:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801050ef:	7f cc                	jg     801050bd <shmdel+0x35>
			{

				kfree(segArray[shmid].pages[i]);
			}
			segArray[shmid].numOfPages=0;
801050f1:	8b 45 08             	mov    0x8(%ebp),%eax
801050f4:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
801050fa:	05 c0 0f 11 80       	add    $0x80110fc0,%eax
801050ff:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
			return i;
80105106:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105109:	eb 05                	jmp    80105110 <shmdel+0x88>
		}
		else
			return -1;
8010510b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105110:	c9                   	leave  
80105111:	c3                   	ret    

80105112 <shmat>:
//SHM_RDWR is specified in shmflg, the segment is attached for read and write.
//There is no notion of a write-only shared memory segment.
//On success shmat() returns the address of the attached shared memory segment.
//Otherwise -1 is returned.
void *shmat(int shmid,int shmflg)
{
80105112:	55                   	push   %ebp
80105113:	89 e5                	mov    %esp,%ebp
80105115:	53                   	push   %ebx
80105116:	83 ec 34             	sub    $0x34,%esp
	segArray[shmid].procs[segArray[shmid].numOfProcs] = proc;	//add proc to shm by shmid
80105119:	8b 45 08             	mov    0x8(%ebp),%eax
8010511c:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
80105122:	05 c0 10 11 80       	add    $0x801110c0,%eax
80105127:	8b 50 0c             	mov    0xc(%eax),%edx
8010512a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105130:	8b 4d 08             	mov    0x8(%ebp),%ecx
80105133:	6b c9 54             	imul   $0x54,%ecx,%ecx
80105136:	01 ca                	add    %ecx,%edx
80105138:	83 c2 10             	add    $0x10,%edx
8010513b:	89 04 95 8c 0f 11 80 	mov    %eax,-0x7feef074(,%edx,4)
	segArray[shmid].numOfProcs++;
80105142:	8b 45 08             	mov    0x8(%ebp),%eax
80105145:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
8010514b:	05 c0 10 11 80       	add    $0x801110c0,%eax
80105150:	8b 40 0c             	mov    0xc(%eax),%eax
80105153:	8d 50 01             	lea    0x1(%eax),%edx
80105156:	8b 45 08             	mov    0x8(%ebp),%eax
80105159:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
8010515f:	05 c0 10 11 80       	add    $0x801110c0,%eax
80105164:	89 50 0c             	mov    %edx,0xc(%eax)
	int i;
	int flag=0;
80105167:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
	if(shmflg & SHM_RDONLY)
8010516e:	8b 45 0c             	mov    0xc(%ebp),%eax
80105171:	83 e0 03             	and    $0x3,%eax
80105174:	85 c0                	test   %eax,%eax
80105176:	74 09                	je     80105181 <shmat+0x6f>
		flag = PTE_U;			//PTE_U = Page table entry flags - user (Hex num)
80105178:	c7 45 f0 04 00 00 00 	movl   $0x4,-0x10(%ebp)
8010517f:	eb 1d                	jmp    8010519e <shmat+0x8c>
	else if (shmflg & SHM_RDWR)
80105181:	8b 45 0c             	mov    0xc(%ebp),%eax
80105184:	83 e0 04             	and    $0x4,%eax
80105187:	85 c0                	test   %eax,%eax
80105189:	74 09                	je     80105194 <shmat+0x82>
		flag = PTE_W|PTE_U;		//PTE_W = Page table entry flags - Writeable
8010518b:	c7 45 f0 06 00 00 00 	movl   $0x6,-0x10(%ebp)
80105192:	eb 0a                	jmp    8010519e <shmat+0x8c>
	else
		return (void*)-1;
80105194:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105199:	e9 e5 00 00 00       	jmp    80105283 <shmat+0x171>
	int sz = proc->sz;
8010519e:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801051a4:	8b 00                	mov    (%eax),%eax
801051a6:	89 45 ec             	mov    %eax,-0x14(%ebp)
	for (i = 0; i < segArray[shmid].numOfPages; i++)
801051a9:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801051b0:	eb 69                	jmp    8010521b <shmat+0x109>
	{
		mappages(proc->pgdir,(void*)proc->sz,PGSIZE,v2p(segArray[shmid].pages[i]), flag);
801051b2:	8b 45 08             	mov    0x8(%ebp),%eax
801051b5:	6b d0 54             	imul   $0x54,%eax,%edx
801051b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801051bb:	01 d0                	add    %edx,%eax
801051bd:	8b 04 85 84 0f 11 80 	mov    -0x7feef07c(,%eax,4),%eax
801051c4:	89 04 24             	mov    %eax,(%esp)
801051c7:	e8 b4 ee ff ff       	call   80104080 <v2p>
801051cc:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
801051d3:	8b 12                	mov    (%edx),%edx
801051d5:	89 d1                	mov    %edx,%ecx
801051d7:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
801051de:	8b 52 04             	mov    0x4(%edx),%edx
801051e1:	8b 5d f0             	mov    -0x10(%ebp),%ebx
801051e4:	89 5c 24 10          	mov    %ebx,0x10(%esp)
801051e8:	89 44 24 0c          	mov    %eax,0xc(%esp)
801051ec:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801051f3:	00 
801051f4:	89 4c 24 04          	mov    %ecx,0x4(%esp)
801051f8:	89 14 24             	mov    %edx,(%esp)
801051fb:	e8 02 08 00 00       	call   80105a02 <mappages>
		proc->sz += PGSIZE;
80105200:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105206:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
8010520d:	8b 12                	mov    (%edx),%edx
8010520f:	81 c2 00 10 00 00    	add    $0x1000,%edx
80105215:	89 10                	mov    %edx,(%eax)
	else if (shmflg & SHM_RDWR)
		flag = PTE_W|PTE_U;		//PTE_W = Page table entry flags - Writeable
	else
		return (void*)-1;
	int sz = proc->sz;
	for (i = 0; i < segArray[shmid].numOfPages; i++)
80105217:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010521b:	8b 45 08             	mov    0x8(%ebp),%eax
8010521e:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
80105224:	05 c0 0f 11 80       	add    $0x80110fc0,%eax
80105229:	8b 40 08             	mov    0x8(%eax),%eax
8010522c:	3b 45 f4             	cmp    -0xc(%ebp),%eax
8010522f:	7f 81                	jg     801051b2 <shmat+0xa0>
	{
		mappages(proc->pgdir,(void*)proc->sz,PGSIZE,v2p(segArray[shmid].pages[i]), flag);
		proc->sz += PGSIZE;
	}
	proc->shmids[proc->next] = shmid;
80105231:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105237:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
8010523e:	8b 92 1c 01 00 00    	mov    0x11c(%edx),%edx
80105244:	8d 4a 1c             	lea    0x1c(%edx),%ecx
80105247:	8b 55 08             	mov    0x8(%ebp),%edx
8010524a:	89 54 88 0c          	mov    %edx,0xc(%eax,%ecx,4)
	proc->locs[proc->next] = (void*)sz;
8010524e:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105254:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
8010525b:	8b 8a 1c 01 00 00    	mov    0x11c(%edx),%ecx
80105261:	8b 55 ec             	mov    -0x14(%ebp),%edx
80105264:	83 c1 30             	add    $0x30,%ecx
80105267:	89 54 88 0c          	mov    %edx,0xc(%eax,%ecx,4)
	proc->next++;
8010526b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105271:	8b 90 1c 01 00 00    	mov    0x11c(%eax),%edx
80105277:	83 c2 01             	add    $0x1,%edx
8010527a:	89 90 1c 01 00 00    	mov    %edx,0x11c(%eax)

	return (void*)sz;
80105280:	8b 45 ec             	mov    -0x14(%ebp),%eax
}
80105283:	83 c4 34             	add    $0x34,%esp
80105286:	5b                   	pop    %ebx
80105287:	5d                   	pop    %ebp
80105288:	c3                   	ret    

80105289 <deleteShmFromProc>:

//called from shmdt.
int deleteShmFromProc(pde_t *pgdir ,const void* end, const void* start)
{
80105289:	55                   	push   %ebp
8010528a:	89 e5                	mov    %esp,%ebp
8010528c:	83 ec 28             	sub    $0x28,%esp

	pte_t *pte;

	for(; start  < end; start += PGSIZE){
8010528f:	eb 2d                	jmp    801052be <deleteShmFromProc+0x35>
		pte = walkpgdir(pgdir, (char*)start, 0);
80105291:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80105298:	00 
80105299:	8b 45 10             	mov    0x10(%ebp),%eax
8010529c:	89 44 24 04          	mov    %eax,0x4(%esp)
801052a0:	8b 45 08             	mov    0x8(%ebp),%eax
801052a3:	89 04 24             	mov    %eax,(%esp)
801052a6:	e8 b5 06 00 00       	call   80105960 <walkpgdir>
801052ab:	89 45 f4             	mov    %eax,-0xc(%ebp)
		*pte = 0;
801052ae:	8b 45 f4             	mov    -0xc(%ebp),%eax
801052b1:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
int deleteShmFromProc(pde_t *pgdir ,const void* end, const void* start)
{

	pte_t *pte;

	for(; start  < end; start += PGSIZE){
801052b7:	81 45 10 00 10 00 00 	addl   $0x1000,0x10(%ebp)
801052be:	8b 45 10             	mov    0x10(%ebp),%eax
801052c1:	3b 45 0c             	cmp    0xc(%ebp),%eax
801052c4:	72 cb                	jb     80105291 <deleteShmFromProc+0x8>
		pte = walkpgdir(pgdir, (char*)start, 0);
		*pte = 0;
	}

	return 0;
801052c6:	b8 00 00 00 00       	mov    $0x0,%eax
}
801052cb:	c9                   	leave  
801052cc:	c3                   	ret    

801052cd <shmdt>:
//shmaddr from the address space of the calling process. The to-be-detached
//segment must be currently attached with shmaddr equal to the value returned by
//the attaching shmat() call.
//On success shmdt() returns 0. Otherwise -1 is returned.
int shmdt(const void*shmaddr)
{
801052cd:	55                   	push   %ebp
801052ce:	89 e5                	mov    %esp,%ebp
801052d0:	83 ec 28             	sub    $0x28,%esp
	int i, shmid;
	for(i=0;i<proc->next;i++)
801052d3:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801052da:	eb 19                	jmp    801052f5 <shmdt+0x28>
	{
		if(shmaddr==proc->locs[i])
801052dc:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801052e2:	8b 55 f4             	mov    -0xc(%ebp),%edx
801052e5:	83 c2 30             	add    $0x30,%edx
801052e8:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
801052ec:	3b 45 08             	cmp    0x8(%ebp),%eax
801052ef:	74 17                	je     80105308 <shmdt+0x3b>
//the attaching shmat() call.
//On success shmdt() returns 0. Otherwise -1 is returned.
int shmdt(const void*shmaddr)
{
	int i, shmid;
	for(i=0;i<proc->next;i++)
801052f1:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801052f5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801052fb:	8b 80 1c 01 00 00    	mov    0x11c(%eax),%eax
80105301:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80105304:	7f d6                	jg     801052dc <shmdt+0xf>
80105306:	eb 01                	jmp    80105309 <shmdt+0x3c>
	{
		if(shmaddr==proc->locs[i])
			break;
80105308:	90                   	nop
	}
	if (i==proc->next)
80105309:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010530f:	8b 80 1c 01 00 00    	mov    0x11c(%eax),%eax
80105315:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80105318:	75 0a                	jne    80105324 <shmdt+0x57>
	{

		return -1;		//proc with this shm addr didn't find
8010531a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010531f:	e9 9d 00 00 00       	jmp    801053c1 <shmdt+0xf4>
	}
	else
	{

		shmid = proc->shmids[i];
80105324:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010532a:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010532d:	83 c2 1c             	add    $0x1c,%edx
80105330:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80105334:	89 45 f0             	mov    %eax,-0x10(%ebp)

		deleteShmFromProc(proc->pgdir,shmaddr+segArray[shmid].numOfPages*PGSIZE,shmaddr);
80105337:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010533a:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
80105340:	05 c0 0f 11 80       	add    $0x80110fc0,%eax
80105345:	8b 40 08             	mov    0x8(%eax),%eax
80105348:	c1 e0 0c             	shl    $0xc,%eax
8010534b:	89 c2                	mov    %eax,%edx
8010534d:	8b 45 08             	mov    0x8(%ebp),%eax
80105350:	8d 0c 02             	lea    (%edx,%eax,1),%ecx
80105353:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105359:	8b 40 04             	mov    0x4(%eax),%eax
8010535c:	8b 55 08             	mov    0x8(%ebp),%edx
8010535f:	89 54 24 08          	mov    %edx,0x8(%esp)
80105363:	89 4c 24 04          	mov    %ecx,0x4(%esp)
80105367:	89 04 24             	mov    %eax,(%esp)
8010536a:	e8 1a ff ff ff       	call   80105289 <deleteShmFromProc>
		segArray[shmid].numOfProcs--;
8010536f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105372:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
80105378:	05 c0 10 11 80       	add    $0x801110c0,%eax
8010537d:	8b 40 0c             	mov    0xc(%eax),%eax
80105380:	8d 50 ff             	lea    -0x1(%eax),%edx
80105383:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105386:	69 c0 50 01 00 00    	imul   $0x150,%eax,%eax
8010538c:	05 c0 10 11 80       	add    $0x801110c0,%eax
80105391:	89 50 0c             	mov    %edx,0xc(%eax)
		proc->locs[i]=0;
80105394:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010539a:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010539d:	83 c2 30             	add    $0x30,%edx
801053a0:	c7 44 90 0c 00 00 00 	movl   $0x0,0xc(%eax,%edx,4)
801053a7:	00 
		proc->shmids[i]=-1;
801053a8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801053ae:	8b 55 f4             	mov    -0xc(%ebp),%edx
801053b1:	83 c2 1c             	add    $0x1c,%edx
801053b4:	c7 44 90 0c ff ff ff 	movl   $0xffffffff,0xc(%eax,%edx,4)
801053bb:	ff 
		return 0;
801053bc:	b8 00 00 00 00       	mov    $0x0,%eax
	}
}
801053c1:	c9                   	leave  
801053c2:	c3                   	ret    

801053c3 <openFile>:
//--------------------UTILS---------------------------


//Similar to sys_open on sysfile.c
struct file* openFile(char *path , int omode)
{
801053c3:	55                   	push   %ebp
801053c4:	89 e5                	mov    %esp,%ebp
801053c6:	83 ec 28             	sub    $0x28,%esp

	struct file *f;
	struct inode *ip;


	if(omode & O_CREATE){
801053c9:	8b 45 0c             	mov    0xc(%ebp),%eax
801053cc:	25 00 02 00 00       	and    $0x200,%eax
801053d1:	85 c0                	test   %eax,%eax
801053d3:	74 40                	je     80105415 <openFile+0x52>

		begin_trans();
801053d5:	e8 b2 de ff ff       	call   8010328c <begin_trans>
		ip = create(path, T_FILE, 0, 0);
801053da:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
801053e1:	00 
801053e2:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
801053e9:	00 
801053ea:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
801053f1:	00 
801053f2:	8b 45 08             	mov    0x8(%ebp),%eax
801053f5:	89 04 24             	mov    %eax,(%esp)
801053f8:	e8 57 02 00 00       	call   80105654 <create>
801053fd:	89 45 f4             	mov    %eax,-0xc(%ebp)
		commit_trans();
80105400:	e8 d0 de ff ff       	call   801032d5 <commit_trans>
		if(ip == 0)
80105405:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105409:	75 58                	jne    80105463 <openFile+0xa0>
		{
			return 0;
8010540b:	b8 00 00 00 00       	mov    $0x0,%eax
80105410:	e9 b7 00 00 00       	jmp    801054cc <openFile+0x109>

		}
	} else {
		if((ip = namei(path)) == 0)
80105415:	8b 45 08             	mov    0x8(%ebp),%eax
80105418:	89 04 24             	mov    %eax,(%esp)
8010541b:	e8 0d d0 ff ff       	call   8010242d <namei>
80105420:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105423:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105427:	75 0a                	jne    80105433 <openFile+0x70>
		{
			return 0;
80105429:	b8 00 00 00 00       	mov    $0x0,%eax
8010542e:	e9 99 00 00 00       	jmp    801054cc <openFile+0x109>
		}
		ilock(ip);
80105433:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105436:	89 04 24             	mov    %eax,(%esp)
80105439:	e8 42 c4 ff ff       	call   80101880 <ilock>
		if(ip->type == T_DIR && omode != O_RDONLY){
8010543e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105441:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80105445:	66 83 f8 01          	cmp    $0x1,%ax
80105449:	75 18                	jne    80105463 <openFile+0xa0>
8010544b:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
8010544f:	74 12                	je     80105463 <openFile+0xa0>
			iunlockput(ip);
80105451:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105454:	89 04 24             	mov    %eax,(%esp)
80105457:	e8 94 c6 ff ff       	call   80101af0 <iunlockput>

			return 0;
8010545c:	b8 00 00 00 00       	mov    $0x0,%eax
80105461:	eb 69                	jmp    801054cc <openFile+0x109>
		}
	}

	if((f = filealloc()) == 0 ){
80105463:	e8 c8 ba ff ff       	call   80100f30 <filealloc>
80105468:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010546b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010546f:	75 23                	jne    80105494 <openFile+0xd1>
		if(f)
80105471:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105475:	74 0b                	je     80105482 <openFile+0xbf>
			fileclose(f);
80105477:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010547a:	89 04 24             	mov    %eax,(%esp)
8010547d:	e8 56 bb ff ff       	call   80100fd8 <fileclose>
		iunlockput(ip);
80105482:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105485:	89 04 24             	mov    %eax,(%esp)
80105488:	e8 63 c6 ff ff       	call   80101af0 <iunlockput>

		return 0;
8010548d:	b8 00 00 00 00       	mov    $0x0,%eax
80105492:	eb 38                	jmp    801054cc <openFile+0x109>
	}
	iunlock(ip);
80105494:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105497:	89 04 24             	mov    %eax,(%esp)
8010549a:	e8 1b c5 ff ff       	call   801019ba <iunlock>
	f->type = FD_INODE;
8010549f:	8b 45 f0             	mov    -0x10(%ebp),%eax
801054a2:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
	f->ip = ip;
801054a8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801054ab:	8b 55 f4             	mov    -0xc(%ebp),%edx
801054ae:	89 50 10             	mov    %edx,0x10(%eax)
	f->off = 0;
801054b1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801054b4:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
	f->readable =1;
801054bb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801054be:	c6 40 08 01          	movb   $0x1,0x8(%eax)
	f->writable = 1;
801054c2:	8b 45 f0             	mov    -0x10(%ebp),%eax
801054c5:	c6 40 09 01          	movb   $0x1,0x9(%eax)
	return f;
801054c9:	8b 45 f0             	mov    -0x10(%ebp),%eax
  f->readable = 1;
  f->writable = 1;

  return f;
	 */
}
801054cc:	c9                   	leave  
801054cd:	c3                   	ret    

801054ce <unlink>:


//from sys_unlink sysfile.c
int unlink(char *path)
{
801054ce:	55                   	push   %ebp
801054cf:	89 e5                	mov    %esp,%ebp
801054d1:	83 ec 48             	sub    $0x48,%esp
	struct dirent de;
	char name[DIRSIZ];
	uint off;


	if((dp = nameiparent(path, name)) == 0)
801054d4:	8d 45 d2             	lea    -0x2e(%ebp),%eax
801054d7:	89 44 24 04          	mov    %eax,0x4(%esp)
801054db:	8b 45 08             	mov    0x8(%ebp),%eax
801054de:	89 04 24             	mov    %eax,(%esp)
801054e1:	e8 69 cf ff ff       	call   8010244f <nameiparent>
801054e6:	89 45 f4             	mov    %eax,-0xc(%ebp)
801054e9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801054ed:	75 0a                	jne    801054f9 <unlink+0x2b>
		return -1;
801054ef:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801054f4:	e9 59 01 00 00       	jmp    80105652 <unlink+0x184>

	begin_trans();
801054f9:	e8 8e dd ff ff       	call   8010328c <begin_trans>

	ilock(dp);
801054fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105501:	89 04 24             	mov    %eax,(%esp)
80105504:	e8 77 c3 ff ff       	call   80101880 <ilock>

	// Cannot unlink "." or "..".
	if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80105509:	c7 44 24 04 d1 96 10 	movl   $0x801096d1,0x4(%esp)
80105510:	80 
80105511:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105514:	89 04 24             	mov    %eax,(%esp)
80105517:	e8 64 cb ff ff       	call   80102080 <namecmp>
8010551c:	85 c0                	test   %eax,%eax
8010551e:	0f 84 19 01 00 00    	je     8010563d <unlink+0x16f>
80105524:	c7 44 24 04 d3 96 10 	movl   $0x801096d3,0x4(%esp)
8010552b:	80 
8010552c:	8d 45 d2             	lea    -0x2e(%ebp),%eax
8010552f:	89 04 24             	mov    %eax,(%esp)
80105532:	e8 49 cb ff ff       	call   80102080 <namecmp>
80105537:	85 c0                	test   %eax,%eax
80105539:	0f 84 fe 00 00 00    	je     8010563d <unlink+0x16f>
		goto bad;

	if((ip = dirlookup(dp, name, &off)) == 0)
8010553f:	8d 45 cc             	lea    -0x34(%ebp),%eax
80105542:	89 44 24 08          	mov    %eax,0x8(%esp)
80105546:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105549:	89 44 24 04          	mov    %eax,0x4(%esp)
8010554d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105550:	89 04 24             	mov    %eax,(%esp)
80105553:	e8 4a cb ff ff       	call   801020a2 <dirlookup>
80105558:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010555b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010555f:	0f 84 d7 00 00 00    	je     8010563c <unlink+0x16e>
		goto bad;
	ilock(ip);
80105565:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105568:	89 04 24             	mov    %eax,(%esp)
8010556b:	e8 10 c3 ff ff       	call   80101880 <ilock>

	if(ip->nlink < 1)
80105570:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105573:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105577:	66 85 c0             	test   %ax,%ax
8010557a:	7f 0c                	jg     80105588 <unlink+0xba>
		panic("unlink: nlink < 1");
8010557c:	c7 04 24 d6 96 10 80 	movl   $0x801096d6,(%esp)
80105583:	e8 aa af ff ff       	call   80100532 <panic>
	memset(&de, 0, sizeof(de));
80105588:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
8010558f:	00 
80105590:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80105597:	00 
80105598:	8d 45 e0             	lea    -0x20(%ebp),%eax
8010559b:	89 04 24             	mov    %eax,(%esp)
8010559e:	e8 bf 08 00 00       	call   80105e62 <memset>

	if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801055a3:	8b 45 cc             	mov    -0x34(%ebp),%eax
801055a6:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
801055ad:	00 
801055ae:	89 44 24 08          	mov    %eax,0x8(%esp)
801055b2:	8d 45 e0             	lea    -0x20(%ebp),%eax
801055b5:	89 44 24 04          	mov    %eax,0x4(%esp)
801055b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801055bc:	89 04 24             	mov    %eax,(%esp)
801055bf:	e8 23 c9 ff ff       	call   80101ee7 <writei>
801055c4:	83 f8 10             	cmp    $0x10,%eax
801055c7:	74 0c                	je     801055d5 <unlink+0x107>
		panic("unlink: writei");
801055c9:	c7 04 24 e8 96 10 80 	movl   $0x801096e8,(%esp)
801055d0:	e8 5d af ff ff       	call   80100532 <panic>
	if(ip->type == T_DIR){
801055d5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801055d8:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801055dc:	66 83 f8 01          	cmp    $0x1,%ax
801055e0:	75 1c                	jne    801055fe <unlink+0x130>
		dp->nlink--;
801055e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801055e5:	0f b7 40 16          	movzwl 0x16(%eax),%eax
801055e9:	8d 50 ff             	lea    -0x1(%eax),%edx
801055ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
801055ef:	66 89 50 16          	mov    %dx,0x16(%eax)
		iupdate(dp);
801055f3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801055f6:	89 04 24             	mov    %eax,(%esp)
801055f9:	e8 c6 c0 ff ff       	call   801016c4 <iupdate>
	}
	iunlockput(dp);
801055fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105601:	89 04 24             	mov    %eax,(%esp)
80105604:	e8 e7 c4 ff ff       	call   80101af0 <iunlockput>

	ip->nlink--;
80105609:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010560c:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105610:	8d 50 ff             	lea    -0x1(%eax),%edx
80105613:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105616:	66 89 50 16          	mov    %dx,0x16(%eax)
	iupdate(ip);
8010561a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010561d:	89 04 24             	mov    %eax,(%esp)
80105620:	e8 9f c0 ff ff       	call   801016c4 <iupdate>
	iunlockput(ip);
80105625:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105628:	89 04 24             	mov    %eax,(%esp)
8010562b:	e8 c0 c4 ff ff       	call   80101af0 <iunlockput>

	commit_trans();
80105630:	e8 a0 dc ff ff       	call   801032d5 <commit_trans>

	return 0;
80105635:	b8 00 00 00 00       	mov    $0x0,%eax
8010563a:	eb 16                	jmp    80105652 <unlink+0x184>
	// Cannot unlink "." or "..".
	if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
		goto bad;

	if((ip = dirlookup(dp, name, &off)) == 0)
		goto bad;
8010563c:	90                   	nop
	commit_trans();

	return 0;

	bad:
	iunlockput(dp);
8010563d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105640:	89 04 24             	mov    %eax,(%esp)
80105643:	e8 a8 c4 ff ff       	call   80101af0 <iunlockput>
	commit_trans();
80105648:	e8 88 dc ff ff       	call   801032d5 <commit_trans>
	return -1;
8010564d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105652:	c9                   	leave  
80105653:	c3                   	ret    

80105654 <create>:

//create from sysfile.c
struct inode* create(char *path, short type, short major, short minor)
{
80105654:	55                   	push   %ebp
80105655:	89 e5                	mov    %esp,%ebp
80105657:	83 ec 48             	sub    $0x48,%esp
8010565a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
8010565d:	8b 55 10             	mov    0x10(%ebp),%edx
80105660:	8b 45 14             	mov    0x14(%ebp),%eax
80105663:	66 89 4d d4          	mov    %cx,-0x2c(%ebp)
80105667:	66 89 55 d0          	mov    %dx,-0x30(%ebp)
8010566b:	66 89 45 cc          	mov    %ax,-0x34(%ebp)
	uint off;
	struct inode *ip, *dp;
	char name[DIRSIZ];

	if((dp = nameiparent(path, name)) == 0)
8010566f:	8d 45 de             	lea    -0x22(%ebp),%eax
80105672:	89 44 24 04          	mov    %eax,0x4(%esp)
80105676:	8b 45 08             	mov    0x8(%ebp),%eax
80105679:	89 04 24             	mov    %eax,(%esp)
8010567c:	e8 ce cd ff ff       	call   8010244f <nameiparent>
80105681:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105684:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105688:	75 0a                	jne    80105694 <create+0x40>
		return 0;
8010568a:	b8 00 00 00 00       	mov    $0x0,%eax
8010568f:	e9 7e 01 00 00       	jmp    80105812 <create+0x1be>

	ilock(dp);
80105694:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105697:	89 04 24             	mov    %eax,(%esp)
8010569a:	e8 e1 c1 ff ff       	call   80101880 <ilock>

	if((ip = dirlookup(dp, name, &off)) != 0){
8010569f:	8d 45 ec             	lea    -0x14(%ebp),%eax
801056a2:	89 44 24 08          	mov    %eax,0x8(%esp)
801056a6:	8d 45 de             	lea    -0x22(%ebp),%eax
801056a9:	89 44 24 04          	mov    %eax,0x4(%esp)
801056ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056b0:	89 04 24             	mov    %eax,(%esp)
801056b3:	e8 ea c9 ff ff       	call   801020a2 <dirlookup>
801056b8:	89 45 f0             	mov    %eax,-0x10(%ebp)
801056bb:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801056bf:	74 47                	je     80105708 <create+0xb4>
		iunlockput(dp);
801056c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056c4:	89 04 24             	mov    %eax,(%esp)
801056c7:	e8 24 c4 ff ff       	call   80101af0 <iunlockput>
		ilock(ip);
801056cc:	8b 45 f0             	mov    -0x10(%ebp),%eax
801056cf:	89 04 24             	mov    %eax,(%esp)
801056d2:	e8 a9 c1 ff ff       	call   80101880 <ilock>
		if(type == T_FILE && ip->type == T_FILE)
801056d7:	66 83 7d d4 02       	cmpw   $0x2,-0x2c(%ebp)
801056dc:	75 15                	jne    801056f3 <create+0x9f>
801056de:	8b 45 f0             	mov    -0x10(%ebp),%eax
801056e1:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801056e5:	66 83 f8 02          	cmp    $0x2,%ax
801056e9:	75 08                	jne    801056f3 <create+0x9f>
			return ip;
801056eb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801056ee:	e9 1f 01 00 00       	jmp    80105812 <create+0x1be>
		iunlockput(ip);
801056f3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801056f6:	89 04 24             	mov    %eax,(%esp)
801056f9:	e8 f2 c3 ff ff       	call   80101af0 <iunlockput>
		return 0;
801056fe:	b8 00 00 00 00       	mov    $0x0,%eax
80105703:	e9 0a 01 00 00       	jmp    80105812 <create+0x1be>
	}


	if((ip = ialloc(dp->dev, type)) == 0)
80105708:	0f bf 55 d4          	movswl -0x2c(%ebp),%edx
8010570c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010570f:	8b 00                	mov    (%eax),%eax
80105711:	89 54 24 04          	mov    %edx,0x4(%esp)
80105715:	89 04 24             	mov    %eax,(%esp)
80105718:	e8 c8 be ff ff       	call   801015e5 <ialloc>
8010571d:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105720:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105724:	75 0c                	jne    80105732 <create+0xde>
		panic("create: ialloc");
80105726:	c7 04 24 f7 96 10 80 	movl   $0x801096f7,(%esp)
8010572d:	e8 00 ae ff ff       	call   80100532 <panic>


	ilock(ip);
80105732:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105735:	89 04 24             	mov    %eax,(%esp)
80105738:	e8 43 c1 ff ff       	call   80101880 <ilock>
	ip->major = major;
8010573d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105740:	0f b7 55 d0          	movzwl -0x30(%ebp),%edx
80105744:	66 89 50 12          	mov    %dx,0x12(%eax)
	ip->minor = minor;
80105748:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010574b:	0f b7 55 cc          	movzwl -0x34(%ebp),%edx
8010574f:	66 89 50 14          	mov    %dx,0x14(%eax)
	ip->nlink = 1;
80105753:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105756:	66 c7 40 16 01 00    	movw   $0x1,0x16(%eax)

	iupdate(ip);
8010575c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010575f:	89 04 24             	mov    %eax,(%esp)
80105762:	e8 5d bf ff ff       	call   801016c4 <iupdate>

	if(type == T_DIR){  // Create . and .. entries.
80105767:	66 83 7d d4 01       	cmpw   $0x1,-0x2c(%ebp)
8010576c:	75 6a                	jne    801057d8 <create+0x184>
		dp->nlink++;  // for ".."
8010576e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105771:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105775:	8d 50 01             	lea    0x1(%eax),%edx
80105778:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010577b:	66 89 50 16          	mov    %dx,0x16(%eax)

		iupdate(dp);
8010577f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105782:	89 04 24             	mov    %eax,(%esp)
80105785:	e8 3a bf ff ff       	call   801016c4 <iupdate>
		// No ip->nlink++ for ".": avoid cyclic ref count.
		if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
8010578a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010578d:	8b 40 04             	mov    0x4(%eax),%eax
80105790:	89 44 24 08          	mov    %eax,0x8(%esp)
80105794:	c7 44 24 04 d1 96 10 	movl   $0x801096d1,0x4(%esp)
8010579b:	80 
8010579c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010579f:	89 04 24             	mov    %eax,(%esp)
801057a2:	e8 c3 c9 ff ff       	call   8010216a <dirlink>
801057a7:	85 c0                	test   %eax,%eax
801057a9:	78 21                	js     801057cc <create+0x178>
801057ab:	8b 45 f4             	mov    -0xc(%ebp),%eax
801057ae:	8b 40 04             	mov    0x4(%eax),%eax
801057b1:	89 44 24 08          	mov    %eax,0x8(%esp)
801057b5:	c7 44 24 04 d3 96 10 	movl   $0x801096d3,0x4(%esp)
801057bc:	80 
801057bd:	8b 45 f0             	mov    -0x10(%ebp),%eax
801057c0:	89 04 24             	mov    %eax,(%esp)
801057c3:	e8 a2 c9 ff ff       	call   8010216a <dirlink>
801057c8:	85 c0                	test   %eax,%eax
801057ca:	79 0c                	jns    801057d8 <create+0x184>
			panic("create dots");
801057cc:	c7 04 24 06 97 10 80 	movl   $0x80109706,(%esp)
801057d3:	e8 5a ad ff ff       	call   80100532 <panic>
	}


	if(dirlink(dp, name, ip->inum) < 0)
801057d8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801057db:	8b 40 04             	mov    0x4(%eax),%eax
801057de:	89 44 24 08          	mov    %eax,0x8(%esp)
801057e2:	8d 45 de             	lea    -0x22(%ebp),%eax
801057e5:	89 44 24 04          	mov    %eax,0x4(%esp)
801057e9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801057ec:	89 04 24             	mov    %eax,(%esp)
801057ef:	e8 76 c9 ff ff       	call   8010216a <dirlink>
801057f4:	85 c0                	test   %eax,%eax
801057f6:	79 0c                	jns    80105804 <create+0x1b0>
		panic("create: dirlink");
801057f8:	c7 04 24 12 97 10 80 	movl   $0x80109712,(%esp)
801057ff:	e8 2e ad ff ff       	call   80100532 <panic>
	iunlockput(dp);
80105804:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105807:	89 04 24             	mov    %eax,(%esp)
8010580a:	e8 e1 c2 ff ff       	call   80101af0 <iunlockput>
	return ip;
8010580f:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80105812:	c9                   	leave  
80105813:	c3                   	ret    

80105814 <itoa>:


void itoa(int n, char* dest)
{
80105814:	55                   	push   %ebp
80105815:	89 e5                	mov    %esp,%ebp
80105817:	83 ec 38             	sub    $0x38,%esp
	char out[10];
	int i = 0, j = 0, k = 0;
8010581a:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80105821:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
80105828:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
	char tmp;
	if (n == 0) {
8010582f:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80105833:	75 64                	jne    80105899 <itoa+0x85>
		out[i++] = '0';
80105835:	8d 55 e1             	lea    -0x1f(%ebp),%edx
80105838:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010583b:	01 d0                	add    %edx,%eax
8010583d:	c6 00 30             	movb   $0x30,(%eax)
80105840:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
	}
	while (n > 0) {
80105844:	eb 53                	jmp    80105899 <itoa+0x85>
		out[i++] = '0' + n % 10;
80105846:	8b 4d 08             	mov    0x8(%ebp),%ecx
80105849:	ba 67 66 66 66       	mov    $0x66666667,%edx
8010584e:	89 c8                	mov    %ecx,%eax
80105850:	f7 ea                	imul   %edx
80105852:	c1 fa 02             	sar    $0x2,%edx
80105855:	89 c8                	mov    %ecx,%eax
80105857:	c1 f8 1f             	sar    $0x1f,%eax
8010585a:	29 c2                	sub    %eax,%edx
8010585c:	89 d0                	mov    %edx,%eax
8010585e:	c1 e0 02             	shl    $0x2,%eax
80105861:	01 d0                	add    %edx,%eax
80105863:	01 c0                	add    %eax,%eax
80105865:	89 ca                	mov    %ecx,%edx
80105867:	29 c2                	sub    %eax,%edx
80105869:	89 d0                	mov    %edx,%eax
8010586b:	83 c0 30             	add    $0x30,%eax
8010586e:	8d 4d e1             	lea    -0x1f(%ebp),%ecx
80105871:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105874:	01 ca                	add    %ecx,%edx
80105876:	88 02                	mov    %al,(%edx)
80105878:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
		n /= 10;
8010587c:	8b 4d 08             	mov    0x8(%ebp),%ecx
8010587f:	ba 67 66 66 66       	mov    $0x66666667,%edx
80105884:	89 c8                	mov    %ecx,%eax
80105886:	f7 ea                	imul   %edx
80105888:	c1 fa 02             	sar    $0x2,%edx
8010588b:	89 c8                	mov    %ecx,%eax
8010588d:	c1 f8 1f             	sar    $0x1f,%eax
80105890:	89 d1                	mov    %edx,%ecx
80105892:	29 c1                	sub    %eax,%ecx
80105894:	89 c8                	mov    %ecx,%eax
80105896:	89 45 08             	mov    %eax,0x8(%ebp)
	int i = 0, j = 0, k = 0;
	char tmp;
	if (n == 0) {
		out[i++] = '0';
	}
	while (n > 0) {
80105899:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010589d:	7f a7                	jg     80105846 <itoa+0x32>
		out[i++] = '0' + n % 10;
		n /= 10;
	}
	k = i-1;
8010589f:	8b 45 f4             	mov    -0xc(%ebp),%eax
801058a2:	83 e8 01             	sub    $0x1,%eax
801058a5:	89 45 ec             	mov    %eax,-0x14(%ebp)

	while (j < k)
801058a8:	eb 39                	jmp    801058e3 <itoa+0xcf>
	{
		tmp = out[j];
801058aa:	8d 55 e1             	lea    -0x1f(%ebp),%edx
801058ad:	8b 45 f0             	mov    -0x10(%ebp),%eax
801058b0:	01 d0                	add    %edx,%eax
801058b2:	0f b6 00             	movzbl (%eax),%eax
801058b5:	88 45 eb             	mov    %al,-0x15(%ebp)
		out[j] = out[k];
801058b8:	8d 55 e1             	lea    -0x1f(%ebp),%edx
801058bb:	8b 45 ec             	mov    -0x14(%ebp),%eax
801058be:	01 d0                	add    %edx,%eax
801058c0:	0f b6 00             	movzbl (%eax),%eax
801058c3:	8d 4d e1             	lea    -0x1f(%ebp),%ecx
801058c6:	8b 55 f0             	mov    -0x10(%ebp),%edx
801058c9:	01 ca                	add    %ecx,%edx
801058cb:	88 02                	mov    %al,(%edx)
		out[k] = tmp;
801058cd:	8d 55 e1             	lea    -0x1f(%ebp),%edx
801058d0:	8b 45 ec             	mov    -0x14(%ebp),%eax
801058d3:	01 c2                	add    %eax,%edx
801058d5:	0f b6 45 eb          	movzbl -0x15(%ebp),%eax
801058d9:	88 02                	mov    %al,(%edx)
		j++;
801058db:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
		k--;
801058df:	83 6d ec 01          	subl   $0x1,-0x14(%ebp)
		out[i++] = '0' + n % 10;
		n /= 10;
	}
	k = i-1;

	while (j < k)
801058e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801058e6:	3b 45 ec             	cmp    -0x14(%ebp),%eax
801058e9:	7c bf                	jl     801058aa <itoa+0x96>
		out[j] = out[k];
		out[k] = tmp;
		j++;
		k--;
	}
	out[i++] = '.';
801058eb:	8d 55 e1             	lea    -0x1f(%ebp),%edx
801058ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
801058f1:	01 d0                	add    %edx,%eax
801058f3:	c6 00 2e             	movb   $0x2e,(%eax)
801058f6:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
	out[i++] = 's';
801058fa:	8d 55 e1             	lea    -0x1f(%ebp),%edx
801058fd:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105900:	01 d0                	add    %edx,%eax
80105902:	c6 00 73             	movb   $0x73,(%eax)
80105905:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
	out[i++] = 'w';
80105909:	8d 55 e1             	lea    -0x1f(%ebp),%edx
8010590c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010590f:	01 d0                	add    %edx,%eax
80105911:	c6 00 77             	movb   $0x77,(%eax)
80105914:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
	out[i++] = 'a';
80105918:	8d 55 e1             	lea    -0x1f(%ebp),%edx
8010591b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010591e:	01 d0                	add    %edx,%eax
80105920:	c6 00 61             	movb   $0x61,(%eax)
80105923:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
	out[i++] = 'p';
80105927:	8d 55 e1             	lea    -0x1f(%ebp),%edx
8010592a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010592d:	01 d0                	add    %edx,%eax
8010592f:	c6 00 70             	movb   $0x70,(%eax)
80105932:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
	out[i++] = '\0';
80105936:	8d 55 e1             	lea    -0x1f(%ebp),%edx
80105939:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010593c:	01 d0                	add    %edx,%eax
8010593e:	c6 00 00             	movb   $0x0,(%eax)
80105941:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
	safestrcpy(dest,out,i);
80105945:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105948:	89 44 24 08          	mov    %eax,0x8(%esp)
8010594c:	8d 45 e1             	lea    -0x1f(%ebp),%eax
8010594f:	89 44 24 04          	mov    %eax,0x4(%esp)
80105953:	8b 45 0c             	mov    0xc(%ebp),%eax
80105956:	89 04 24             	mov    %eax,(%esp)
80105959:	e8 34 07 00 00       	call   80106092 <safestrcpy>

}
8010595e:	c9                   	leave  
8010595f:	c3                   	ret    

80105960 <walkpgdir>:

// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va.  If alloc!=0,
// create any required page table pages.
static pte_t * walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
80105960:	55                   	push   %ebp
80105961:	89 e5                	mov    %esp,%ebp
80105963:	83 ec 28             	sub    $0x28,%esp
	pde_t *pde;
	pte_t *pgtab;

	pde = &pgdir[PDX(va)];
80105966:	8b 45 0c             	mov    0xc(%ebp),%eax
80105969:	c1 e8 16             	shr    $0x16,%eax
8010596c:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80105973:	8b 45 08             	mov    0x8(%ebp),%eax
80105976:	01 d0                	add    %edx,%eax
80105978:	89 45 f0             	mov    %eax,-0x10(%ebp)
	if(*pde & PTE_P){
8010597b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010597e:	8b 00                	mov    (%eax),%eax
80105980:	83 e0 01             	and    $0x1,%eax
80105983:	85 c0                	test   %eax,%eax
80105985:	74 17                	je     8010599e <walkpgdir+0x3e>
		pgtab = (pte_t*)p2v(PTE_ADDR(*pde));
80105987:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010598a:	8b 00                	mov    (%eax),%eax
8010598c:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80105991:	89 04 24             	mov    %eax,(%esp)
80105994:	e8 f4 e6 ff ff       	call   8010408d <p2v>
80105999:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010599c:	eb 4b                	jmp    801059e9 <walkpgdir+0x89>
	} else {
		if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
8010599e:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801059a2:	74 0e                	je     801059b2 <walkpgdir+0x52>
801059a4:	e8 bd d1 ff ff       	call   80102b66 <kalloc>
801059a9:	89 45 f4             	mov    %eax,-0xc(%ebp)
801059ac:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801059b0:	75 07                	jne    801059b9 <walkpgdir+0x59>
			return 0;
801059b2:	b8 00 00 00 00       	mov    $0x0,%eax
801059b7:	eb 47                	jmp    80105a00 <walkpgdir+0xa0>
		// Make sure all those PTE_P bits are zero.
		memset(pgtab, 0, PGSIZE);
801059b9:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801059c0:	00 
801059c1:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801059c8:	00 
801059c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801059cc:	89 04 24             	mov    %eax,(%esp)
801059cf:	e8 8e 04 00 00       	call   80105e62 <memset>
		// The permissions here are overly generous, but they can
		// be further restricted by the permissions in the page table
		// entries, if necessary.
		*pde = v2p(pgtab) | PTE_P | PTE_W | PTE_U;
801059d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801059d7:	89 04 24             	mov    %eax,(%esp)
801059da:	e8 a1 e6 ff ff       	call   80104080 <v2p>
801059df:	89 c2                	mov    %eax,%edx
801059e1:	83 ca 07             	or     $0x7,%edx
801059e4:	8b 45 f0             	mov    -0x10(%ebp),%eax
801059e7:	89 10                	mov    %edx,(%eax)
	}
	return &pgtab[PTX(va)];
801059e9:	8b 45 0c             	mov    0xc(%ebp),%eax
801059ec:	c1 e8 0c             	shr    $0xc,%eax
801059ef:	25 ff 03 00 00       	and    $0x3ff,%eax
801059f4:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
801059fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801059fe:	01 d0                	add    %edx,%eax
}
80105a00:	c9                   	leave  
80105a01:	c3                   	ret    

80105a02 <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
80105a02:	55                   	push   %ebp
80105a03:	89 e5                	mov    %esp,%ebp
80105a05:	83 ec 28             	sub    $0x28,%esp
	char *a, *last;
	pte_t *pte;

	a = (char*)PGROUNDDOWN((uint)va);
80105a08:	8b 45 0c             	mov    0xc(%ebp),%eax
80105a0b:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80105a10:	89 45 f4             	mov    %eax,-0xc(%ebp)
	last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80105a13:	8b 55 0c             	mov    0xc(%ebp),%edx
80105a16:	8b 45 10             	mov    0x10(%ebp),%eax
80105a19:	01 d0                	add    %edx,%eax
80105a1b:	83 e8 01             	sub    $0x1,%eax
80105a1e:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80105a23:	89 45 f0             	mov    %eax,-0x10(%ebp)
	for(;;){
		if((pte = walkpgdir(pgdir, a, 1)) == 0)
80105a26:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
80105a2d:	00 
80105a2e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a31:	89 44 24 04          	mov    %eax,0x4(%esp)
80105a35:	8b 45 08             	mov    0x8(%ebp),%eax
80105a38:	89 04 24             	mov    %eax,(%esp)
80105a3b:	e8 20 ff ff ff       	call   80105960 <walkpgdir>
80105a40:	89 45 ec             	mov    %eax,-0x14(%ebp)
80105a43:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80105a47:	75 07                	jne    80105a50 <mappages+0x4e>
			return -1;
80105a49:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105a4e:	eb 46                	jmp    80105a96 <mappages+0x94>
		if(*pte & PTE_P)
80105a50:	8b 45 ec             	mov    -0x14(%ebp),%eax
80105a53:	8b 00                	mov    (%eax),%eax
80105a55:	83 e0 01             	and    $0x1,%eax
80105a58:	85 c0                	test   %eax,%eax
80105a5a:	74 0c                	je     80105a68 <mappages+0x66>
			panic("remap");
80105a5c:	c7 04 24 22 97 10 80 	movl   $0x80109722,(%esp)
80105a63:	e8 ca aa ff ff       	call   80100532 <panic>
		*pte = pa | perm | PTE_P;
80105a68:	8b 45 18             	mov    0x18(%ebp),%eax
80105a6b:	0b 45 14             	or     0x14(%ebp),%eax
80105a6e:	89 c2                	mov    %eax,%edx
80105a70:	83 ca 01             	or     $0x1,%edx
80105a73:	8b 45 ec             	mov    -0x14(%ebp),%eax
80105a76:	89 10                	mov    %edx,(%eax)
		if(a == last)
80105a78:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a7b:	3b 45 f0             	cmp    -0x10(%ebp),%eax
80105a7e:	74 10                	je     80105a90 <mappages+0x8e>
			break;
		a += PGSIZE;
80105a80:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
		pa += PGSIZE;
80105a87:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
	}
80105a8e:	eb 96                	jmp    80105a26 <mappages+0x24>
			return -1;
		if(*pte & PTE_P)
			panic("remap");
		*pte = pa | perm | PTE_P;
		if(a == last)
			break;
80105a90:	90                   	nop
		a += PGSIZE;
		pa += PGSIZE;
	}
	return 0;
80105a91:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105a96:	c9                   	leave  
80105a97:	c3                   	ret    

80105a98 <writeFile>:

void writeFile(struct file* f)
{
80105a98:	55                   	push   %ebp
80105a99:	89 e5                	mov    %esp,%ebp
80105a9b:	83 ec 28             	sub    $0x28,%esp
	pte_t *pte;
	uint pa, i;

	for(i = 0; i < proc->sz; i += PGSIZE){
80105a9e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80105aa5:	e9 83 00 00 00       	jmp    80105b2d <writeFile+0x95>
		if((pte = walkpgdir(proc->pgdir, (void *) i, 0)) == 0)
80105aaa:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105aad:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105ab3:	8b 40 04             	mov    0x4(%eax),%eax
80105ab6:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80105abd:	00 
80105abe:	89 54 24 04          	mov    %edx,0x4(%esp)
80105ac2:	89 04 24             	mov    %eax,(%esp)
80105ac5:	e8 96 fe ff ff       	call   80105960 <walkpgdir>
80105aca:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105acd:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105ad1:	75 0c                	jne    80105adf <writeFile+0x47>
			panic("copyuvm: pte should exist");
80105ad3:	c7 04 24 28 97 10 80 	movl   $0x80109728,(%esp)
80105ada:	e8 53 aa ff ff       	call   80100532 <panic>
		if(!(*pte & PTE_P))
80105adf:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105ae2:	8b 00                	mov    (%eax),%eax
80105ae4:	83 e0 01             	and    $0x1,%eax
80105ae7:	85 c0                	test   %eax,%eax
80105ae9:	75 0c                	jne    80105af7 <writeFile+0x5f>
			panic("copyuvm: page not present");
80105aeb:	c7 04 24 42 97 10 80 	movl   $0x80109742,(%esp)
80105af2:	e8 3b aa ff ff       	call   80100532 <panic>
		pa = PTE_ADDR(*pte);
80105af7:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105afa:	8b 00                	mov    (%eax),%eax
80105afc:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80105b01:	89 45 ec             	mov    %eax,-0x14(%ebp)
		filewrite(f,(char*)p2v(pa), PGSIZE);
80105b04:	8b 45 ec             	mov    -0x14(%ebp),%eax
80105b07:	89 04 24             	mov    %eax,(%esp)
80105b0a:	e8 7e e5 ff ff       	call   8010408d <p2v>
80105b0f:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80105b16:	00 
80105b17:	89 44 24 04          	mov    %eax,0x4(%esp)
80105b1b:	8b 45 08             	mov    0x8(%ebp),%eax
80105b1e:	89 04 24             	mov    %eax,(%esp)
80105b21:	e8 93 b6 ff ff       	call   801011b9 <filewrite>
void writeFile(struct file* f)
{
	pte_t *pte;
	uint pa, i;

	for(i = 0; i < proc->sz; i += PGSIZE){
80105b26:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80105b2d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105b33:	8b 00                	mov    (%eax),%eax
80105b35:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80105b38:	0f 87 6c ff ff ff    	ja     80105aaa <writeFile+0x12>
		pa = PTE_ADDR(*pte);
		filewrite(f,(char*)p2v(pa), PGSIZE);


	}
}
80105b3e:	c9                   	leave  
80105b3f:	c3                   	ret    

80105b40 <swapOut>:


void swapOut(char fileName[10]) {
80105b40:	55                   	push   %ebp
80105b41:	89 e5                	mov    %esp,%ebp
80105b43:	83 ec 28             	sub    $0x28,%esp
	//swap out process
	struct file* f;
	int flag = {-1};
80105b46:	c7 45 f4 ff ff ff ff 	movl   $0xffffffff,-0xc(%ebp)

	itoa(proc->pid, fileName);
80105b4d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105b53:	8b 40 10             	mov    0x10(%eax),%eax
80105b56:	8b 55 08             	mov    0x8(%ebp),%edx
80105b59:	89 54 24 04          	mov    %edx,0x4(%esp)
80105b5d:	89 04 24             	mov    %eax,(%esp)
80105b60:	e8 af fc ff ff       	call   80105814 <itoa>
	f = openFile(fileName, flag);
80105b65:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b68:	89 44 24 04          	mov    %eax,0x4(%esp)
80105b6c:	8b 45 08             	mov    0x8(%ebp),%eax
80105b6f:	89 04 24             	mov    %eax,(%esp)
80105b72:	e8 4c f8 ff ff       	call   801053c3 <openFile>
80105b77:	89 45 f0             	mov    %eax,-0x10(%ebp)
	writeFile(f);
80105b7a:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b7d:	89 04 24             	mov    %eax,(%esp)
80105b80:	e8 13 ff ff ff       	call   80105a98 <writeFile>
	fileclose(f);
80105b85:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b88:	89 04 24             	mov    %eax,(%esp)
80105b8b:	e8 48 b4 ff ff       	call   80100fd8 <fileclose>
	proc->state = SLEEPING_SUSPENDED;
80105b90:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105b96:	c7 40 0c 06 00 00 00 	movl   $0x6,0xc(%eax)
}
80105b9d:	c9                   	leave  
80105b9e:	c3                   	ret    
80105b9f:	90                   	nop

80105ba0 <readeflags>:
  asm volatile("ltr %0" : : "r" (sel));
}

static inline uint
readeflags(void)
{
80105ba0:	55                   	push   %ebp
80105ba1:	89 e5                	mov    %esp,%ebp
80105ba3:	53                   	push   %ebx
80105ba4:	83 ec 10             	sub    $0x10,%esp
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
80105ba7:	9c                   	pushf  
80105ba8:	5b                   	pop    %ebx
80105ba9:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return eflags;
80105bac:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80105baf:	83 c4 10             	add    $0x10,%esp
80105bb2:	5b                   	pop    %ebx
80105bb3:	5d                   	pop    %ebp
80105bb4:	c3                   	ret    

80105bb5 <cli>:
  asm volatile("movw %0, %%gs" : : "r" (v));
}

static inline void
cli(void)
{
80105bb5:	55                   	push   %ebp
80105bb6:	89 e5                	mov    %esp,%ebp
  asm volatile("cli");
80105bb8:	fa                   	cli    
}
80105bb9:	5d                   	pop    %ebp
80105bba:	c3                   	ret    

80105bbb <sti>:

static inline void
sti(void)
{
80105bbb:	55                   	push   %ebp
80105bbc:	89 e5                	mov    %esp,%ebp
  asm volatile("sti");
80105bbe:	fb                   	sti    
}
80105bbf:	5d                   	pop    %ebp
80105bc0:	c3                   	ret    

80105bc1 <xchg>:

static inline uint
xchg(volatile uint *addr, uint newval)
{
80105bc1:	55                   	push   %ebp
80105bc2:	89 e5                	mov    %esp,%ebp
80105bc4:	53                   	push   %ebx
80105bc5:	83 ec 10             	sub    $0x10,%esp
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
               "+m" (*addr), "=a" (result) :
80105bc8:	8b 55 08             	mov    0x8(%ebp),%edx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80105bcb:	8b 45 0c             	mov    0xc(%ebp),%eax
               "+m" (*addr), "=a" (result) :
80105bce:	8b 4d 08             	mov    0x8(%ebp),%ecx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80105bd1:	89 c3                	mov    %eax,%ebx
80105bd3:	89 d8                	mov    %ebx,%eax
80105bd5:	f0 87 02             	lock xchg %eax,(%edx)
80105bd8:	89 c3                	mov    %eax,%ebx
80105bda:	89 5d f8             	mov    %ebx,-0x8(%ebp)
               "+m" (*addr), "=a" (result) :
               "1" (newval) :
               "cc");
  return result;
80105bdd:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80105be0:	83 c4 10             	add    $0x10,%esp
80105be3:	5b                   	pop    %ebx
80105be4:	5d                   	pop    %ebp
80105be5:	c3                   	ret    

80105be6 <initlock>:
#include "proc.h"
#include "spinlock.h"

void
initlock(struct spinlock *lk, char *name)
{
80105be6:	55                   	push   %ebp
80105be7:	89 e5                	mov    %esp,%ebp
  lk->name = name;
80105be9:	8b 45 08             	mov    0x8(%ebp),%eax
80105bec:	8b 55 0c             	mov    0xc(%ebp),%edx
80105bef:	89 50 04             	mov    %edx,0x4(%eax)
  lk->locked = 0;
80105bf2:	8b 45 08             	mov    0x8(%ebp),%eax
80105bf5:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  lk->cpu = 0;
80105bfb:	8b 45 08             	mov    0x8(%ebp),%eax
80105bfe:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
}
80105c05:	5d                   	pop    %ebp
80105c06:	c3                   	ret    

80105c07 <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
80105c07:	55                   	push   %ebp
80105c08:	89 e5                	mov    %esp,%ebp
80105c0a:	83 ec 18             	sub    $0x18,%esp
  pushcli(); // disable interrupts to avoid deadlock.
80105c0d:	e8 49 01 00 00       	call   80105d5b <pushcli>
  if(holding(lk))
80105c12:	8b 45 08             	mov    0x8(%ebp),%eax
80105c15:	89 04 24             	mov    %eax,(%esp)
80105c18:	e8 14 01 00 00       	call   80105d31 <holding>
80105c1d:	85 c0                	test   %eax,%eax
80105c1f:	74 0c                	je     80105c2d <acquire+0x26>
    panic("acquire");
80105c21:	c7 04 24 ac 97 10 80 	movl   $0x801097ac,(%esp)
80105c28:	e8 05 a9 ff ff       	call   80100532 <panic>

  // The xchg is atomic.
  // It also serializes, so that reads after acquire are not
  // reordered before it. 
  while(xchg(&lk->locked, 1) != 0)
80105c2d:	90                   	nop
80105c2e:	8b 45 08             	mov    0x8(%ebp),%eax
80105c31:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80105c38:	00 
80105c39:	89 04 24             	mov    %eax,(%esp)
80105c3c:	e8 80 ff ff ff       	call   80105bc1 <xchg>
80105c41:	85 c0                	test   %eax,%eax
80105c43:	75 e9                	jne    80105c2e <acquire+0x27>
    ;

  // Record info about lock acquisition for debugging.
  lk->cpu = cpu;
80105c45:	8b 45 08             	mov    0x8(%ebp),%eax
80105c48:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80105c4f:	89 50 08             	mov    %edx,0x8(%eax)
  getcallerpcs(&lk, lk->pcs);
80105c52:	8b 45 08             	mov    0x8(%ebp),%eax
80105c55:	83 c0 0c             	add    $0xc,%eax
80105c58:	89 44 24 04          	mov    %eax,0x4(%esp)
80105c5c:	8d 45 08             	lea    0x8(%ebp),%eax
80105c5f:	89 04 24             	mov    %eax,(%esp)
80105c62:	e8 51 00 00 00       	call   80105cb8 <getcallerpcs>
}
80105c67:	c9                   	leave  
80105c68:	c3                   	ret    

80105c69 <release>:

// Release the lock.
void
release(struct spinlock *lk)
{
80105c69:	55                   	push   %ebp
80105c6a:	89 e5                	mov    %esp,%ebp
80105c6c:	83 ec 18             	sub    $0x18,%esp
  if(!holding(lk))
80105c6f:	8b 45 08             	mov    0x8(%ebp),%eax
80105c72:	89 04 24             	mov    %eax,(%esp)
80105c75:	e8 b7 00 00 00       	call   80105d31 <holding>
80105c7a:	85 c0                	test   %eax,%eax
80105c7c:	75 0c                	jne    80105c8a <release+0x21>
    panic("release");
80105c7e:	c7 04 24 b4 97 10 80 	movl   $0x801097b4,(%esp)
80105c85:	e8 a8 a8 ff ff       	call   80100532 <panic>

  lk->pcs[0] = 0;
80105c8a:	8b 45 08             	mov    0x8(%ebp),%eax
80105c8d:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
  lk->cpu = 0;
80105c94:	8b 45 08             	mov    0x8(%ebp),%eax
80105c97:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
  // But the 2007 Intel 64 Architecture Memory Ordering White
  // Paper says that Intel 64 and IA-32 will not move a load
  // after a store. So lock->locked = 0 would work here.
  // The xchg being asm volatile ensures gcc emits it after
  // the above assignments (and after the critical section).
  xchg(&lk->locked, 0);
80105c9e:	8b 45 08             	mov    0x8(%ebp),%eax
80105ca1:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80105ca8:	00 
80105ca9:	89 04 24             	mov    %eax,(%esp)
80105cac:	e8 10 ff ff ff       	call   80105bc1 <xchg>

  popcli();
80105cb1:	e8 ed 00 00 00       	call   80105da3 <popcli>
}
80105cb6:	c9                   	leave  
80105cb7:	c3                   	ret    

80105cb8 <getcallerpcs>:

// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80105cb8:	55                   	push   %ebp
80105cb9:	89 e5                	mov    %esp,%ebp
80105cbb:	83 ec 10             	sub    $0x10,%esp
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
80105cbe:	8b 45 08             	mov    0x8(%ebp),%eax
80105cc1:	83 e8 08             	sub    $0x8,%eax
80105cc4:	89 45 fc             	mov    %eax,-0x4(%ebp)
  for(i = 0; i < 10; i++){
80105cc7:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
80105cce:	eb 38                	jmp    80105d08 <getcallerpcs+0x50>
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
80105cd0:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
80105cd4:	74 53                	je     80105d29 <getcallerpcs+0x71>
80105cd6:	81 7d fc ff ff ff 7f 	cmpl   $0x7fffffff,-0x4(%ebp)
80105cdd:	76 4a                	jbe    80105d29 <getcallerpcs+0x71>
80105cdf:	83 7d fc ff          	cmpl   $0xffffffff,-0x4(%ebp)
80105ce3:	74 44                	je     80105d29 <getcallerpcs+0x71>
      break;
    pcs[i] = ebp[1];     // saved %eip
80105ce5:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105ce8:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80105cef:	8b 45 0c             	mov    0xc(%ebp),%eax
80105cf2:	01 c2                	add    %eax,%edx
80105cf4:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105cf7:	8b 40 04             	mov    0x4(%eax),%eax
80105cfa:	89 02                	mov    %eax,(%edx)
    ebp = (uint*)ebp[0]; // saved %ebp
80105cfc:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105cff:	8b 00                	mov    (%eax),%eax
80105d01:	89 45 fc             	mov    %eax,-0x4(%ebp)
{
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
  for(i = 0; i < 10; i++){
80105d04:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
80105d08:	83 7d f8 09          	cmpl   $0x9,-0x8(%ebp)
80105d0c:	7e c2                	jle    80105cd0 <getcallerpcs+0x18>
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
80105d0e:	eb 19                	jmp    80105d29 <getcallerpcs+0x71>
    pcs[i] = 0;
80105d10:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105d13:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80105d1a:	8b 45 0c             	mov    0xc(%ebp),%eax
80105d1d:	01 d0                	add    %edx,%eax
80105d1f:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
80105d25:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
80105d29:	83 7d f8 09          	cmpl   $0x9,-0x8(%ebp)
80105d2d:	7e e1                	jle    80105d10 <getcallerpcs+0x58>
    pcs[i] = 0;
}
80105d2f:	c9                   	leave  
80105d30:	c3                   	ret    

80105d31 <holding>:

// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80105d31:	55                   	push   %ebp
80105d32:	89 e5                	mov    %esp,%ebp
  return lock->locked && lock->cpu == cpu;
80105d34:	8b 45 08             	mov    0x8(%ebp),%eax
80105d37:	8b 00                	mov    (%eax),%eax
80105d39:	85 c0                	test   %eax,%eax
80105d3b:	74 17                	je     80105d54 <holding+0x23>
80105d3d:	8b 45 08             	mov    0x8(%ebp),%eax
80105d40:	8b 50 08             	mov    0x8(%eax),%edx
80105d43:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105d49:	39 c2                	cmp    %eax,%edx
80105d4b:	75 07                	jne    80105d54 <holding+0x23>
80105d4d:	b8 01 00 00 00       	mov    $0x1,%eax
80105d52:	eb 05                	jmp    80105d59 <holding+0x28>
80105d54:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105d59:	5d                   	pop    %ebp
80105d5a:	c3                   	ret    

80105d5b <pushcli>:
// it takes two popcli to undo two pushcli.  Also, if interrupts
// are off, then pushcli, popcli leaves them off.

void
pushcli(void)
{
80105d5b:	55                   	push   %ebp
80105d5c:	89 e5                	mov    %esp,%ebp
80105d5e:	83 ec 10             	sub    $0x10,%esp
  int eflags;
  
  eflags = readeflags();
80105d61:	e8 3a fe ff ff       	call   80105ba0 <readeflags>
80105d66:	89 45 fc             	mov    %eax,-0x4(%ebp)
  cli();
80105d69:	e8 47 fe ff ff       	call   80105bb5 <cli>
  if(cpu->ncli++ == 0)
80105d6e:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105d74:	8b 90 ac 00 00 00    	mov    0xac(%eax),%edx
80105d7a:	85 d2                	test   %edx,%edx
80105d7c:	0f 94 c1             	sete   %cl
80105d7f:	83 c2 01             	add    $0x1,%edx
80105d82:	89 90 ac 00 00 00    	mov    %edx,0xac(%eax)
80105d88:	84 c9                	test   %cl,%cl
80105d8a:	74 15                	je     80105da1 <pushcli+0x46>
    cpu->intena = eflags & FL_IF;
80105d8c:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105d92:	8b 55 fc             	mov    -0x4(%ebp),%edx
80105d95:	81 e2 00 02 00 00    	and    $0x200,%edx
80105d9b:	89 90 b0 00 00 00    	mov    %edx,0xb0(%eax)
}
80105da1:	c9                   	leave  
80105da2:	c3                   	ret    

80105da3 <popcli>:

void
popcli(void)
{
80105da3:	55                   	push   %ebp
80105da4:	89 e5                	mov    %esp,%ebp
80105da6:	83 ec 18             	sub    $0x18,%esp
  if(readeflags()&FL_IF)
80105da9:	e8 f2 fd ff ff       	call   80105ba0 <readeflags>
80105dae:	25 00 02 00 00       	and    $0x200,%eax
80105db3:	85 c0                	test   %eax,%eax
80105db5:	74 0c                	je     80105dc3 <popcli+0x20>
    panic("popcli - interruptible");
80105db7:	c7 04 24 bc 97 10 80 	movl   $0x801097bc,(%esp)
80105dbe:	e8 6f a7 ff ff       	call   80100532 <panic>
  if(--cpu->ncli < 0)
80105dc3:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105dc9:	8b 90 ac 00 00 00    	mov    0xac(%eax),%edx
80105dcf:	83 ea 01             	sub    $0x1,%edx
80105dd2:	89 90 ac 00 00 00    	mov    %edx,0xac(%eax)
80105dd8:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
80105dde:	85 c0                	test   %eax,%eax
80105de0:	79 0c                	jns    80105dee <popcli+0x4b>
    panic("popcli");
80105de2:	c7 04 24 d3 97 10 80 	movl   $0x801097d3,(%esp)
80105de9:	e8 44 a7 ff ff       	call   80100532 <panic>
  if(cpu->ncli == 0 && cpu->intena)
80105dee:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105df4:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
80105dfa:	85 c0                	test   %eax,%eax
80105dfc:	75 15                	jne    80105e13 <popcli+0x70>
80105dfe:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105e04:	8b 80 b0 00 00 00    	mov    0xb0(%eax),%eax
80105e0a:	85 c0                	test   %eax,%eax
80105e0c:	74 05                	je     80105e13 <popcli+0x70>
    sti();
80105e0e:	e8 a8 fd ff ff       	call   80105bbb <sti>
}
80105e13:	c9                   	leave  
80105e14:	c3                   	ret    
80105e15:	66 90                	xchg   %ax,%ax
80105e17:	90                   	nop

80105e18 <stosb>:
               "cc");
}

static inline void
stosb(void *addr, int data, int cnt)
{
80105e18:	55                   	push   %ebp
80105e19:	89 e5                	mov    %esp,%ebp
80105e1b:	57                   	push   %edi
80105e1c:	53                   	push   %ebx
  asm volatile("cld; rep stosb" :
80105e1d:	8b 4d 08             	mov    0x8(%ebp),%ecx
80105e20:	8b 55 10             	mov    0x10(%ebp),%edx
80105e23:	8b 45 0c             	mov    0xc(%ebp),%eax
80105e26:	89 cb                	mov    %ecx,%ebx
80105e28:	89 df                	mov    %ebx,%edi
80105e2a:	89 d1                	mov    %edx,%ecx
80105e2c:	fc                   	cld    
80105e2d:	f3 aa                	rep stos %al,%es:(%edi)
80105e2f:	89 ca                	mov    %ecx,%edx
80105e31:	89 fb                	mov    %edi,%ebx
80105e33:	89 5d 08             	mov    %ebx,0x8(%ebp)
80105e36:	89 55 10             	mov    %edx,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "0" (addr), "1" (cnt), "a" (data) :
               "memory", "cc");
}
80105e39:	5b                   	pop    %ebx
80105e3a:	5f                   	pop    %edi
80105e3b:	5d                   	pop    %ebp
80105e3c:	c3                   	ret    

80105e3d <stosl>:

static inline void
stosl(void *addr, int data, int cnt)
{
80105e3d:	55                   	push   %ebp
80105e3e:	89 e5                	mov    %esp,%ebp
80105e40:	57                   	push   %edi
80105e41:	53                   	push   %ebx
  asm volatile("cld; rep stosl" :
80105e42:	8b 4d 08             	mov    0x8(%ebp),%ecx
80105e45:	8b 55 10             	mov    0x10(%ebp),%edx
80105e48:	8b 45 0c             	mov    0xc(%ebp),%eax
80105e4b:	89 cb                	mov    %ecx,%ebx
80105e4d:	89 df                	mov    %ebx,%edi
80105e4f:	89 d1                	mov    %edx,%ecx
80105e51:	fc                   	cld    
80105e52:	f3 ab                	rep stos %eax,%es:(%edi)
80105e54:	89 ca                	mov    %ecx,%edx
80105e56:	89 fb                	mov    %edi,%ebx
80105e58:	89 5d 08             	mov    %ebx,0x8(%ebp)
80105e5b:	89 55 10             	mov    %edx,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "0" (addr), "1" (cnt), "a" (data) :
               "memory", "cc");
}
80105e5e:	5b                   	pop    %ebx
80105e5f:	5f                   	pop    %edi
80105e60:	5d                   	pop    %ebp
80105e61:	c3                   	ret    

80105e62 <memset>:
#include "types.h"
#include "x86.h"

void*
memset(void *dst, int c, uint n)
{
80105e62:	55                   	push   %ebp
80105e63:	89 e5                	mov    %esp,%ebp
80105e65:	83 ec 0c             	sub    $0xc,%esp
  if ((int)dst%4 == 0 && n%4 == 0){
80105e68:	8b 45 08             	mov    0x8(%ebp),%eax
80105e6b:	83 e0 03             	and    $0x3,%eax
80105e6e:	85 c0                	test   %eax,%eax
80105e70:	75 49                	jne    80105ebb <memset+0x59>
80105e72:	8b 45 10             	mov    0x10(%ebp),%eax
80105e75:	83 e0 03             	and    $0x3,%eax
80105e78:	85 c0                	test   %eax,%eax
80105e7a:	75 3f                	jne    80105ebb <memset+0x59>
    c &= 0xFF;
80105e7c:	81 65 0c ff 00 00 00 	andl   $0xff,0xc(%ebp)
    stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
80105e83:	8b 45 10             	mov    0x10(%ebp),%eax
80105e86:	c1 e8 02             	shr    $0x2,%eax
80105e89:	89 c2                	mov    %eax,%edx
80105e8b:	8b 45 0c             	mov    0xc(%ebp),%eax
80105e8e:	89 c1                	mov    %eax,%ecx
80105e90:	c1 e1 18             	shl    $0x18,%ecx
80105e93:	8b 45 0c             	mov    0xc(%ebp),%eax
80105e96:	c1 e0 10             	shl    $0x10,%eax
80105e99:	09 c1                	or     %eax,%ecx
80105e9b:	8b 45 0c             	mov    0xc(%ebp),%eax
80105e9e:	c1 e0 08             	shl    $0x8,%eax
80105ea1:	09 c8                	or     %ecx,%eax
80105ea3:	0b 45 0c             	or     0xc(%ebp),%eax
80105ea6:	89 54 24 08          	mov    %edx,0x8(%esp)
80105eaa:	89 44 24 04          	mov    %eax,0x4(%esp)
80105eae:	8b 45 08             	mov    0x8(%ebp),%eax
80105eb1:	89 04 24             	mov    %eax,(%esp)
80105eb4:	e8 84 ff ff ff       	call   80105e3d <stosl>
80105eb9:	eb 19                	jmp    80105ed4 <memset+0x72>
  } else
    stosb(dst, c, n);
80105ebb:	8b 45 10             	mov    0x10(%ebp),%eax
80105ebe:	89 44 24 08          	mov    %eax,0x8(%esp)
80105ec2:	8b 45 0c             	mov    0xc(%ebp),%eax
80105ec5:	89 44 24 04          	mov    %eax,0x4(%esp)
80105ec9:	8b 45 08             	mov    0x8(%ebp),%eax
80105ecc:	89 04 24             	mov    %eax,(%esp)
80105ecf:	e8 44 ff ff ff       	call   80105e18 <stosb>
  return dst;
80105ed4:	8b 45 08             	mov    0x8(%ebp),%eax
}
80105ed7:	c9                   	leave  
80105ed8:	c3                   	ret    

80105ed9 <memcmp>:

int
memcmp(const void *v1, const void *v2, uint n)
{
80105ed9:	55                   	push   %ebp
80105eda:	89 e5                	mov    %esp,%ebp
80105edc:	83 ec 10             	sub    $0x10,%esp
  const uchar *s1, *s2;
  
  s1 = v1;
80105edf:	8b 45 08             	mov    0x8(%ebp),%eax
80105ee2:	89 45 fc             	mov    %eax,-0x4(%ebp)
  s2 = v2;
80105ee5:	8b 45 0c             	mov    0xc(%ebp),%eax
80105ee8:	89 45 f8             	mov    %eax,-0x8(%ebp)
  while(n-- > 0){
80105eeb:	eb 32                	jmp    80105f1f <memcmp+0x46>
    if(*s1 != *s2)
80105eed:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105ef0:	0f b6 10             	movzbl (%eax),%edx
80105ef3:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105ef6:	0f b6 00             	movzbl (%eax),%eax
80105ef9:	38 c2                	cmp    %al,%dl
80105efb:	74 1a                	je     80105f17 <memcmp+0x3e>
      return *s1 - *s2;
80105efd:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105f00:	0f b6 00             	movzbl (%eax),%eax
80105f03:	0f b6 d0             	movzbl %al,%edx
80105f06:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105f09:	0f b6 00             	movzbl (%eax),%eax
80105f0c:	0f b6 c0             	movzbl %al,%eax
80105f0f:	89 d1                	mov    %edx,%ecx
80105f11:	29 c1                	sub    %eax,%ecx
80105f13:	89 c8                	mov    %ecx,%eax
80105f15:	eb 1c                	jmp    80105f33 <memcmp+0x5a>
    s1++, s2++;
80105f17:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80105f1b:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
{
  const uchar *s1, *s2;
  
  s1 = v1;
  s2 = v2;
  while(n-- > 0){
80105f1f:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105f23:	0f 95 c0             	setne  %al
80105f26:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80105f2a:	84 c0                	test   %al,%al
80105f2c:	75 bf                	jne    80105eed <memcmp+0x14>
    if(*s1 != *s2)
      return *s1 - *s2;
    s1++, s2++;
  }

  return 0;
80105f2e:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105f33:	c9                   	leave  
80105f34:	c3                   	ret    

80105f35 <memmove>:

void*
memmove(void *dst, const void *src, uint n)
{
80105f35:	55                   	push   %ebp
80105f36:	89 e5                	mov    %esp,%ebp
80105f38:	83 ec 10             	sub    $0x10,%esp
  const char *s;
  char *d;

  s = src;
80105f3b:	8b 45 0c             	mov    0xc(%ebp),%eax
80105f3e:	89 45 fc             	mov    %eax,-0x4(%ebp)
  d = dst;
80105f41:	8b 45 08             	mov    0x8(%ebp),%eax
80105f44:	89 45 f8             	mov    %eax,-0x8(%ebp)
  if(s < d && s + n > d){
80105f47:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105f4a:	3b 45 f8             	cmp    -0x8(%ebp),%eax
80105f4d:	73 54                	jae    80105fa3 <memmove+0x6e>
80105f4f:	8b 45 10             	mov    0x10(%ebp),%eax
80105f52:	8b 55 fc             	mov    -0x4(%ebp),%edx
80105f55:	01 d0                	add    %edx,%eax
80105f57:	3b 45 f8             	cmp    -0x8(%ebp),%eax
80105f5a:	76 47                	jbe    80105fa3 <memmove+0x6e>
    s += n;
80105f5c:	8b 45 10             	mov    0x10(%ebp),%eax
80105f5f:	01 45 fc             	add    %eax,-0x4(%ebp)
    d += n;
80105f62:	8b 45 10             	mov    0x10(%ebp),%eax
80105f65:	01 45 f8             	add    %eax,-0x8(%ebp)
    while(n-- > 0)
80105f68:	eb 13                	jmp    80105f7d <memmove+0x48>
      *--d = *--s;
80105f6a:	83 6d f8 01          	subl   $0x1,-0x8(%ebp)
80105f6e:	83 6d fc 01          	subl   $0x1,-0x4(%ebp)
80105f72:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105f75:	0f b6 10             	movzbl (%eax),%edx
80105f78:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105f7b:	88 10                	mov    %dl,(%eax)
  s = src;
  d = dst;
  if(s < d && s + n > d){
    s += n;
    d += n;
    while(n-- > 0)
80105f7d:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105f81:	0f 95 c0             	setne  %al
80105f84:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80105f88:	84 c0                	test   %al,%al
80105f8a:	75 de                	jne    80105f6a <memmove+0x35>
  const char *s;
  char *d;

  s = src;
  d = dst;
  if(s < d && s + n > d){
80105f8c:	eb 25                	jmp    80105fb3 <memmove+0x7e>
    d += n;
    while(n-- > 0)
      *--d = *--s;
  } else
    while(n-- > 0)
      *d++ = *s++;
80105f8e:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105f91:	0f b6 10             	movzbl (%eax),%edx
80105f94:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105f97:	88 10                	mov    %dl,(%eax)
80105f99:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
80105f9d:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80105fa1:	eb 01                	jmp    80105fa4 <memmove+0x6f>
    s += n;
    d += n;
    while(n-- > 0)
      *--d = *--s;
  } else
    while(n-- > 0)
80105fa3:	90                   	nop
80105fa4:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105fa8:	0f 95 c0             	setne  %al
80105fab:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80105faf:	84 c0                	test   %al,%al
80105fb1:	75 db                	jne    80105f8e <memmove+0x59>
      *d++ = *s++;

  return dst;
80105fb3:	8b 45 08             	mov    0x8(%ebp),%eax
}
80105fb6:	c9                   	leave  
80105fb7:	c3                   	ret    

80105fb8 <memcpy>:

// memcpy exists to placate GCC.  Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
80105fb8:	55                   	push   %ebp
80105fb9:	89 e5                	mov    %esp,%ebp
80105fbb:	83 ec 0c             	sub    $0xc,%esp
  return memmove(dst, src, n);
80105fbe:	8b 45 10             	mov    0x10(%ebp),%eax
80105fc1:	89 44 24 08          	mov    %eax,0x8(%esp)
80105fc5:	8b 45 0c             	mov    0xc(%ebp),%eax
80105fc8:	89 44 24 04          	mov    %eax,0x4(%esp)
80105fcc:	8b 45 08             	mov    0x8(%ebp),%eax
80105fcf:	89 04 24             	mov    %eax,(%esp)
80105fd2:	e8 5e ff ff ff       	call   80105f35 <memmove>
}
80105fd7:	c9                   	leave  
80105fd8:	c3                   	ret    

80105fd9 <strncmp>:

int
strncmp(const char *p, const char *q, uint n)
{
80105fd9:	55                   	push   %ebp
80105fda:	89 e5                	mov    %esp,%ebp
  while(n > 0 && *p && *p == *q)
80105fdc:	eb 0c                	jmp    80105fea <strncmp+0x11>
    n--, p++, q++;
80105fde:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80105fe2:	83 45 08 01          	addl   $0x1,0x8(%ebp)
80105fe6:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
}

int
strncmp(const char *p, const char *q, uint n)
{
  while(n > 0 && *p && *p == *q)
80105fea:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105fee:	74 1a                	je     8010600a <strncmp+0x31>
80105ff0:	8b 45 08             	mov    0x8(%ebp),%eax
80105ff3:	0f b6 00             	movzbl (%eax),%eax
80105ff6:	84 c0                	test   %al,%al
80105ff8:	74 10                	je     8010600a <strncmp+0x31>
80105ffa:	8b 45 08             	mov    0x8(%ebp),%eax
80105ffd:	0f b6 10             	movzbl (%eax),%edx
80106000:	8b 45 0c             	mov    0xc(%ebp),%eax
80106003:	0f b6 00             	movzbl (%eax),%eax
80106006:	38 c2                	cmp    %al,%dl
80106008:	74 d4                	je     80105fde <strncmp+0x5>
    n--, p++, q++;
  if(n == 0)
8010600a:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
8010600e:	75 07                	jne    80106017 <strncmp+0x3e>
    return 0;
80106010:	b8 00 00 00 00       	mov    $0x0,%eax
80106015:	eb 18                	jmp    8010602f <strncmp+0x56>
  return (uchar)*p - (uchar)*q;
80106017:	8b 45 08             	mov    0x8(%ebp),%eax
8010601a:	0f b6 00             	movzbl (%eax),%eax
8010601d:	0f b6 d0             	movzbl %al,%edx
80106020:	8b 45 0c             	mov    0xc(%ebp),%eax
80106023:	0f b6 00             	movzbl (%eax),%eax
80106026:	0f b6 c0             	movzbl %al,%eax
80106029:	89 d1                	mov    %edx,%ecx
8010602b:	29 c1                	sub    %eax,%ecx
8010602d:	89 c8                	mov    %ecx,%eax
}
8010602f:	5d                   	pop    %ebp
80106030:	c3                   	ret    

80106031 <strncpy>:

char*
strncpy(char *s, const char *t, int n)
{
80106031:	55                   	push   %ebp
80106032:	89 e5                	mov    %esp,%ebp
80106034:	83 ec 10             	sub    $0x10,%esp
  char *os;
  
  os = s;
80106037:	8b 45 08             	mov    0x8(%ebp),%eax
8010603a:	89 45 fc             	mov    %eax,-0x4(%ebp)
  while(n-- > 0 && (*s++ = *t++) != 0)
8010603d:	90                   	nop
8010603e:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80106042:	0f 9f c0             	setg   %al
80106045:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80106049:	84 c0                	test   %al,%al
8010604b:	74 30                	je     8010607d <strncpy+0x4c>
8010604d:	8b 45 0c             	mov    0xc(%ebp),%eax
80106050:	0f b6 10             	movzbl (%eax),%edx
80106053:	8b 45 08             	mov    0x8(%ebp),%eax
80106056:	88 10                	mov    %dl,(%eax)
80106058:	8b 45 08             	mov    0x8(%ebp),%eax
8010605b:	0f b6 00             	movzbl (%eax),%eax
8010605e:	84 c0                	test   %al,%al
80106060:	0f 95 c0             	setne  %al
80106063:	83 45 08 01          	addl   $0x1,0x8(%ebp)
80106067:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
8010606b:	84 c0                	test   %al,%al
8010606d:	75 cf                	jne    8010603e <strncpy+0xd>
    ;
  while(n-- > 0)
8010606f:	eb 0c                	jmp    8010607d <strncpy+0x4c>
    *s++ = 0;
80106071:	8b 45 08             	mov    0x8(%ebp),%eax
80106074:	c6 00 00             	movb   $0x0,(%eax)
80106077:	83 45 08 01          	addl   $0x1,0x8(%ebp)
8010607b:	eb 01                	jmp    8010607e <strncpy+0x4d>
  char *os;
  
  os = s;
  while(n-- > 0 && (*s++ = *t++) != 0)
    ;
  while(n-- > 0)
8010607d:	90                   	nop
8010607e:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80106082:	0f 9f c0             	setg   %al
80106085:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80106089:	84 c0                	test   %al,%al
8010608b:	75 e4                	jne    80106071 <strncpy+0x40>
    *s++ = 0;
  return os;
8010608d:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80106090:	c9                   	leave  
80106091:	c3                   	ret    

80106092 <safestrcpy>:

// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
80106092:	55                   	push   %ebp
80106093:	89 e5                	mov    %esp,%ebp
80106095:	83 ec 10             	sub    $0x10,%esp
  char *os;
  
  os = s;
80106098:	8b 45 08             	mov    0x8(%ebp),%eax
8010609b:	89 45 fc             	mov    %eax,-0x4(%ebp)
  if(n <= 0)
8010609e:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801060a2:	7f 05                	jg     801060a9 <safestrcpy+0x17>
    return os;
801060a4:	8b 45 fc             	mov    -0x4(%ebp),%eax
801060a7:	eb 35                	jmp    801060de <safestrcpy+0x4c>
  while(--n > 0 && (*s++ = *t++) != 0)
801060a9:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
801060ad:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801060b1:	7e 22                	jle    801060d5 <safestrcpy+0x43>
801060b3:	8b 45 0c             	mov    0xc(%ebp),%eax
801060b6:	0f b6 10             	movzbl (%eax),%edx
801060b9:	8b 45 08             	mov    0x8(%ebp),%eax
801060bc:	88 10                	mov    %dl,(%eax)
801060be:	8b 45 08             	mov    0x8(%ebp),%eax
801060c1:	0f b6 00             	movzbl (%eax),%eax
801060c4:	84 c0                	test   %al,%al
801060c6:	0f 95 c0             	setne  %al
801060c9:	83 45 08 01          	addl   $0x1,0x8(%ebp)
801060cd:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
801060d1:	84 c0                	test   %al,%al
801060d3:	75 d4                	jne    801060a9 <safestrcpy+0x17>
    ;
  *s = 0;
801060d5:	8b 45 08             	mov    0x8(%ebp),%eax
801060d8:	c6 00 00             	movb   $0x0,(%eax)
  return os;
801060db:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
801060de:	c9                   	leave  
801060df:	c3                   	ret    

801060e0 <strlen>:

int
strlen(const char *s)
{
801060e0:	55                   	push   %ebp
801060e1:	89 e5                	mov    %esp,%ebp
801060e3:	83 ec 10             	sub    $0x10,%esp
  int n;

  for(n = 0; s[n]; n++)
801060e6:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
801060ed:	eb 04                	jmp    801060f3 <strlen+0x13>
801060ef:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
801060f3:	8b 55 fc             	mov    -0x4(%ebp),%edx
801060f6:	8b 45 08             	mov    0x8(%ebp),%eax
801060f9:	01 d0                	add    %edx,%eax
801060fb:	0f b6 00             	movzbl (%eax),%eax
801060fe:	84 c0                	test   %al,%al
80106100:	75 ed                	jne    801060ef <strlen+0xf>
    ;
  return n;
80106102:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80106105:	c9                   	leave  
80106106:	c3                   	ret    
80106107:	90                   	nop

80106108 <swtch>:
# Save current register context in old
# and then load register context from new.

.globl swtch
swtch:
  movl 4(%esp), %eax
80106108:	8b 44 24 04          	mov    0x4(%esp),%eax
  movl 8(%esp), %edx
8010610c:	8b 54 24 08          	mov    0x8(%esp),%edx

  # Save old callee-save registers
  pushl %ebp
80106110:	55                   	push   %ebp
  pushl %ebx
80106111:	53                   	push   %ebx
  pushl %esi
80106112:	56                   	push   %esi
  pushl %edi
80106113:	57                   	push   %edi

  # Switch stacks
  movl %esp, (%eax)
80106114:	89 20                	mov    %esp,(%eax)
  movl %edx, %esp
80106116:	89 d4                	mov    %edx,%esp

  # Load new callee-save registers
  popl %edi
80106118:	5f                   	pop    %edi
  popl %esi
80106119:	5e                   	pop    %esi
  popl %ebx
8010611a:	5b                   	pop    %ebx
  popl %ebp
8010611b:	5d                   	pop    %ebp
  ret
8010611c:	c3                   	ret    
8010611d:	66 90                	xchg   %ax,%ax
8010611f:	90                   	nop

80106120 <fetchint>:
// to a saved program counter, and then the first argument.

// Fetch the int at addr from process p.
int
fetchint(struct proc *p, uint addr, int *ip)
{
80106120:	55                   	push   %ebp
80106121:	89 e5                	mov    %esp,%ebp
  if(addr >= p->sz || addr+4 > p->sz)
80106123:	8b 45 08             	mov    0x8(%ebp),%eax
80106126:	8b 00                	mov    (%eax),%eax
80106128:	3b 45 0c             	cmp    0xc(%ebp),%eax
8010612b:	76 0f                	jbe    8010613c <fetchint+0x1c>
8010612d:	8b 45 0c             	mov    0xc(%ebp),%eax
80106130:	8d 50 04             	lea    0x4(%eax),%edx
80106133:	8b 45 08             	mov    0x8(%ebp),%eax
80106136:	8b 00                	mov    (%eax),%eax
80106138:	39 c2                	cmp    %eax,%edx
8010613a:	76 07                	jbe    80106143 <fetchint+0x23>
    return -1;
8010613c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106141:	eb 0f                	jmp    80106152 <fetchint+0x32>
  *ip = *(int*)(addr);
80106143:	8b 45 0c             	mov    0xc(%ebp),%eax
80106146:	8b 10                	mov    (%eax),%edx
80106148:	8b 45 10             	mov    0x10(%ebp),%eax
8010614b:	89 10                	mov    %edx,(%eax)
  return 0;
8010614d:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106152:	5d                   	pop    %ebp
80106153:	c3                   	ret    

80106154 <fetchstr>:
// Fetch the nul-terminated string at addr from process p.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(struct proc *p, uint addr, char **pp)
{
80106154:	55                   	push   %ebp
80106155:	89 e5                	mov    %esp,%ebp
80106157:	83 ec 10             	sub    $0x10,%esp
  char *s, *ep;

  if(addr >= p->sz)
8010615a:	8b 45 08             	mov    0x8(%ebp),%eax
8010615d:	8b 00                	mov    (%eax),%eax
8010615f:	3b 45 0c             	cmp    0xc(%ebp),%eax
80106162:	77 07                	ja     8010616b <fetchstr+0x17>
    return -1;
80106164:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106169:	eb 45                	jmp    801061b0 <fetchstr+0x5c>
  *pp = (char*)addr;
8010616b:	8b 55 0c             	mov    0xc(%ebp),%edx
8010616e:	8b 45 10             	mov    0x10(%ebp),%eax
80106171:	89 10                	mov    %edx,(%eax)
  ep = (char*)p->sz;
80106173:	8b 45 08             	mov    0x8(%ebp),%eax
80106176:	8b 00                	mov    (%eax),%eax
80106178:	89 45 f8             	mov    %eax,-0x8(%ebp)
  for(s = *pp; s < ep; s++)
8010617b:	8b 45 10             	mov    0x10(%ebp),%eax
8010617e:	8b 00                	mov    (%eax),%eax
80106180:	89 45 fc             	mov    %eax,-0x4(%ebp)
80106183:	eb 1e                	jmp    801061a3 <fetchstr+0x4f>
    if(*s == 0)
80106185:	8b 45 fc             	mov    -0x4(%ebp),%eax
80106188:	0f b6 00             	movzbl (%eax),%eax
8010618b:	84 c0                	test   %al,%al
8010618d:	75 10                	jne    8010619f <fetchstr+0x4b>
      return s - *pp;
8010618f:	8b 55 fc             	mov    -0x4(%ebp),%edx
80106192:	8b 45 10             	mov    0x10(%ebp),%eax
80106195:	8b 00                	mov    (%eax),%eax
80106197:	89 d1                	mov    %edx,%ecx
80106199:	29 c1                	sub    %eax,%ecx
8010619b:	89 c8                	mov    %ecx,%eax
8010619d:	eb 11                	jmp    801061b0 <fetchstr+0x5c>

  if(addr >= p->sz)
    return -1;
  *pp = (char*)addr;
  ep = (char*)p->sz;
  for(s = *pp; s < ep; s++)
8010619f:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
801061a3:	8b 45 fc             	mov    -0x4(%ebp),%eax
801061a6:	3b 45 f8             	cmp    -0x8(%ebp),%eax
801061a9:	72 da                	jb     80106185 <fetchstr+0x31>
    if(*s == 0)
      return s - *pp;
  return -1;
801061ab:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
801061b0:	c9                   	leave  
801061b1:	c3                   	ret    

801061b2 <argint>:

// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
801061b2:	55                   	push   %ebp
801061b3:	89 e5                	mov    %esp,%ebp
801061b5:	83 ec 0c             	sub    $0xc,%esp
  return fetchint(proc, proc->tf->esp + 4 + 4*n, ip);
801061b8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801061be:	8b 40 18             	mov    0x18(%eax),%eax
801061c1:	8b 50 44             	mov    0x44(%eax),%edx
801061c4:	8b 45 08             	mov    0x8(%ebp),%eax
801061c7:	c1 e0 02             	shl    $0x2,%eax
801061ca:	01 d0                	add    %edx,%eax
801061cc:	8d 48 04             	lea    0x4(%eax),%ecx
801061cf:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801061d5:	8b 55 0c             	mov    0xc(%ebp),%edx
801061d8:	89 54 24 08          	mov    %edx,0x8(%esp)
801061dc:	89 4c 24 04          	mov    %ecx,0x4(%esp)
801061e0:	89 04 24             	mov    %eax,(%esp)
801061e3:	e8 38 ff ff ff       	call   80106120 <fetchint>
}
801061e8:	c9                   	leave  
801061e9:	c3                   	ret    

801061ea <argptr>:
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size n bytes.  Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
801061ea:	55                   	push   %ebp
801061eb:	89 e5                	mov    %esp,%ebp
801061ed:	83 ec 18             	sub    $0x18,%esp
  int i;
  
  if(argint(n, &i) < 0)
801061f0:	8d 45 fc             	lea    -0x4(%ebp),%eax
801061f3:	89 44 24 04          	mov    %eax,0x4(%esp)
801061f7:	8b 45 08             	mov    0x8(%ebp),%eax
801061fa:	89 04 24             	mov    %eax,(%esp)
801061fd:	e8 b0 ff ff ff       	call   801061b2 <argint>
80106202:	85 c0                	test   %eax,%eax
80106204:	79 07                	jns    8010620d <argptr+0x23>
    return -1;
80106206:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010620b:	eb 3d                	jmp    8010624a <argptr+0x60>
  if((uint)i >= proc->sz || (uint)i+size > proc->sz)
8010620d:	8b 45 fc             	mov    -0x4(%ebp),%eax
80106210:	89 c2                	mov    %eax,%edx
80106212:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106218:	8b 00                	mov    (%eax),%eax
8010621a:	39 c2                	cmp    %eax,%edx
8010621c:	73 16                	jae    80106234 <argptr+0x4a>
8010621e:	8b 45 fc             	mov    -0x4(%ebp),%eax
80106221:	89 c2                	mov    %eax,%edx
80106223:	8b 45 10             	mov    0x10(%ebp),%eax
80106226:	01 c2                	add    %eax,%edx
80106228:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010622e:	8b 00                	mov    (%eax),%eax
80106230:	39 c2                	cmp    %eax,%edx
80106232:	76 07                	jbe    8010623b <argptr+0x51>
    return -1;
80106234:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106239:	eb 0f                	jmp    8010624a <argptr+0x60>
  *pp = (char*)i;
8010623b:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010623e:	89 c2                	mov    %eax,%edx
80106240:	8b 45 0c             	mov    0xc(%ebp),%eax
80106243:	89 10                	mov    %edx,(%eax)
  return 0;
80106245:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010624a:	c9                   	leave  
8010624b:	c3                   	ret    

8010624c <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
8010624c:	55                   	push   %ebp
8010624d:	89 e5                	mov    %esp,%ebp
8010624f:	83 ec 1c             	sub    $0x1c,%esp
  int addr;
  if(argint(n, &addr) < 0)
80106252:	8d 45 fc             	lea    -0x4(%ebp),%eax
80106255:	89 44 24 04          	mov    %eax,0x4(%esp)
80106259:	8b 45 08             	mov    0x8(%ebp),%eax
8010625c:	89 04 24             	mov    %eax,(%esp)
8010625f:	e8 4e ff ff ff       	call   801061b2 <argint>
80106264:	85 c0                	test   %eax,%eax
80106266:	79 07                	jns    8010626f <argstr+0x23>
    return -1;
80106268:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010626d:	eb 1e                	jmp    8010628d <argstr+0x41>
  return fetchstr(proc, addr, pp);
8010626f:	8b 45 fc             	mov    -0x4(%ebp),%eax
80106272:	89 c2                	mov    %eax,%edx
80106274:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010627a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
8010627d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
80106281:	89 54 24 04          	mov    %edx,0x4(%esp)
80106285:	89 04 24             	mov    %eax,(%esp)
80106288:	e8 c7 fe ff ff       	call   80106154 <fetchstr>
}
8010628d:	c9                   	leave  
8010628e:	c3                   	ret    

8010628f <syscall>:
};


void
syscall(void)
{
8010628f:	55                   	push   %ebp
80106290:	89 e5                	mov    %esp,%ebp
80106292:	53                   	push   %ebx
80106293:	83 ec 24             	sub    $0x24,%esp
  int num;

  num = proc->tf->eax;
80106296:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010629c:	8b 40 18             	mov    0x18(%eax),%eax
8010629f:	8b 40 1c             	mov    0x1c(%eax),%eax
801062a2:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(num >= 0 && num < SYS_open && syscalls[num]) {
801062a5:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801062a9:	78 2e                	js     801062d9 <syscall+0x4a>
801062ab:	83 7d f4 0e          	cmpl   $0xe,-0xc(%ebp)
801062af:	7f 28                	jg     801062d9 <syscall+0x4a>
801062b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801062b4:	8b 04 85 80 c0 10 80 	mov    -0x7fef3f80(,%eax,4),%eax
801062bb:	85 c0                	test   %eax,%eax
801062bd:	74 1a                	je     801062d9 <syscall+0x4a>
    proc->tf->eax = syscalls[num]();
801062bf:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801062c5:	8b 58 18             	mov    0x18(%eax),%ebx
801062c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801062cb:	8b 04 85 80 c0 10 80 	mov    -0x7fef3f80(,%eax,4),%eax
801062d2:	ff d0                	call   *%eax
801062d4:	89 43 1c             	mov    %eax,0x1c(%ebx)
801062d7:	eb 73                	jmp    8010634c <syscall+0xbd>
  } else if (num >= SYS_open && num < NELEM(syscalls) && syscalls[num]) {
801062d9:	83 7d f4 0e          	cmpl   $0xe,-0xc(%ebp)
801062dd:	7e 30                	jle    8010630f <syscall+0x80>
801062df:	8b 45 f4             	mov    -0xc(%ebp),%eax
801062e2:	83 f8 1b             	cmp    $0x1b,%eax
801062e5:	77 28                	ja     8010630f <syscall+0x80>
801062e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801062ea:	8b 04 85 80 c0 10 80 	mov    -0x7fef3f80(,%eax,4),%eax
801062f1:	85 c0                	test   %eax,%eax
801062f3:	74 1a                	je     8010630f <syscall+0x80>
    proc->tf->eax = syscalls[num]();
801062f5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801062fb:	8b 58 18             	mov    0x18(%eax),%ebx
801062fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106301:	8b 04 85 80 c0 10 80 	mov    -0x7fef3f80(,%eax,4),%eax
80106308:	ff d0                	call   *%eax
8010630a:	89 43 1c             	mov    %eax,0x1c(%ebx)
8010630d:	eb 3d                	jmp    8010634c <syscall+0xbd>
  } else {
    cprintf("%d %s: unknown sys call %d\n",
            proc->pid, proc->name, num);
8010630f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106315:	8d 48 6c             	lea    0x6c(%eax),%ecx
80106318:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  if(num >= 0 && num < SYS_open && syscalls[num]) {
    proc->tf->eax = syscalls[num]();
  } else if (num >= SYS_open && num < NELEM(syscalls) && syscalls[num]) {
    proc->tf->eax = syscalls[num]();
  } else {
    cprintf("%d %s: unknown sys call %d\n",
8010631e:	8b 40 10             	mov    0x10(%eax),%eax
80106321:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106324:	89 54 24 0c          	mov    %edx,0xc(%esp)
80106328:	89 4c 24 08          	mov    %ecx,0x8(%esp)
8010632c:	89 44 24 04          	mov    %eax,0x4(%esp)
80106330:	c7 04 24 da 97 10 80 	movl   $0x801097da,(%esp)
80106337:	e8 5a a0 ff ff       	call   80100396 <cprintf>
            proc->pid, proc->name, num);
    proc->tf->eax = -1;
8010633c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106342:	8b 40 18             	mov    0x18(%eax),%eax
80106345:	c7 40 1c ff ff ff ff 	movl   $0xffffffff,0x1c(%eax)
  }
}
8010634c:	83 c4 24             	add    $0x24,%esp
8010634f:	5b                   	pop    %ebx
80106350:	5d                   	pop    %ebp
80106351:	c3                   	ret    
80106352:	66 90                	xchg   %ax,%ax

80106354 <argfd>:

// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
{
80106354:	55                   	push   %ebp
80106355:	89 e5                	mov    %esp,%ebp
80106357:	83 ec 28             	sub    $0x28,%esp
  int fd;
  struct file *f;

  if(argint(n, &fd) < 0)
8010635a:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010635d:	89 44 24 04          	mov    %eax,0x4(%esp)
80106361:	8b 45 08             	mov    0x8(%ebp),%eax
80106364:	89 04 24             	mov    %eax,(%esp)
80106367:	e8 46 fe ff ff       	call   801061b2 <argint>
8010636c:	85 c0                	test   %eax,%eax
8010636e:	79 07                	jns    80106377 <argfd+0x23>
    return -1;
80106370:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106375:	eb 50                	jmp    801063c7 <argfd+0x73>
  if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
80106377:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010637a:	85 c0                	test   %eax,%eax
8010637c:	78 21                	js     8010639f <argfd+0x4b>
8010637e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106381:	83 f8 0f             	cmp    $0xf,%eax
80106384:	7f 19                	jg     8010639f <argfd+0x4b>
80106386:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010638c:	8b 55 f0             	mov    -0x10(%ebp),%edx
8010638f:	83 c2 08             	add    $0x8,%edx
80106392:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
80106396:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106399:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010639d:	75 07                	jne    801063a6 <argfd+0x52>
    return -1;
8010639f:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801063a4:	eb 21                	jmp    801063c7 <argfd+0x73>
  if(pfd)
801063a6:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
801063aa:	74 08                	je     801063b4 <argfd+0x60>
    *pfd = fd;
801063ac:	8b 55 f0             	mov    -0x10(%ebp),%edx
801063af:	8b 45 0c             	mov    0xc(%ebp),%eax
801063b2:	89 10                	mov    %edx,(%eax)
  if(pf)
801063b4:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801063b8:	74 08                	je     801063c2 <argfd+0x6e>
    *pf = f;
801063ba:	8b 45 10             	mov    0x10(%ebp),%eax
801063bd:	8b 55 f4             	mov    -0xc(%ebp),%edx
801063c0:	89 10                	mov    %edx,(%eax)
  return 0;
801063c2:	b8 00 00 00 00       	mov    $0x0,%eax
}
801063c7:	c9                   	leave  
801063c8:	c3                   	ret    

801063c9 <fdalloc>:

// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
801063c9:	55                   	push   %ebp
801063ca:	89 e5                	mov    %esp,%ebp
801063cc:	83 ec 10             	sub    $0x10,%esp
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
801063cf:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
801063d6:	eb 30                	jmp    80106408 <fdalloc+0x3f>
    if(proc->ofile[fd] == 0){
801063d8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801063de:	8b 55 fc             	mov    -0x4(%ebp),%edx
801063e1:	83 c2 08             	add    $0x8,%edx
801063e4:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801063e8:	85 c0                	test   %eax,%eax
801063ea:	75 18                	jne    80106404 <fdalloc+0x3b>
      proc->ofile[fd] = f;
801063ec:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801063f2:	8b 55 fc             	mov    -0x4(%ebp),%edx
801063f5:	8d 4a 08             	lea    0x8(%edx),%ecx
801063f8:	8b 55 08             	mov    0x8(%ebp),%edx
801063fb:	89 54 88 08          	mov    %edx,0x8(%eax,%ecx,4)
      return fd;
801063ff:	8b 45 fc             	mov    -0x4(%ebp),%eax
80106402:	eb 0f                	jmp    80106413 <fdalloc+0x4a>
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
80106404:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80106408:	83 7d fc 0f          	cmpl   $0xf,-0x4(%ebp)
8010640c:	7e ca                	jle    801063d8 <fdalloc+0xf>
    if(proc->ofile[fd] == 0){
      proc->ofile[fd] = f;
      return fd;
    }
  }
  return -1;
8010640e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80106413:	c9                   	leave  
80106414:	c3                   	ret    

80106415 <sys_dup>:

int
sys_dup(void)
{
80106415:	55                   	push   %ebp
80106416:	89 e5                	mov    %esp,%ebp
80106418:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int fd;
  
  if(argfd(0, 0, &f) < 0)
8010641b:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010641e:	89 44 24 08          	mov    %eax,0x8(%esp)
80106422:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106429:	00 
8010642a:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106431:	e8 1e ff ff ff       	call   80106354 <argfd>
80106436:	85 c0                	test   %eax,%eax
80106438:	79 07                	jns    80106441 <sys_dup+0x2c>
    return -1;
8010643a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010643f:	eb 29                	jmp    8010646a <sys_dup+0x55>
  if((fd=fdalloc(f)) < 0)
80106441:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106444:	89 04 24             	mov    %eax,(%esp)
80106447:	e8 7d ff ff ff       	call   801063c9 <fdalloc>
8010644c:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010644f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106453:	79 07                	jns    8010645c <sys_dup+0x47>
    return -1;
80106455:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010645a:	eb 0e                	jmp    8010646a <sys_dup+0x55>
  filedup(f);
8010645c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010645f:	89 04 24             	mov    %eax,(%esp)
80106462:	e8 29 ab ff ff       	call   80100f90 <filedup>
  return fd;
80106467:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
8010646a:	c9                   	leave  
8010646b:	c3                   	ret    

8010646c <sys_read>:

int
sys_read(void)
{
8010646c:	55                   	push   %ebp
8010646d:	89 e5                	mov    %esp,%ebp
8010646f:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80106472:	8d 45 f4             	lea    -0xc(%ebp),%eax
80106475:	89 44 24 08          	mov    %eax,0x8(%esp)
80106479:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106480:	00 
80106481:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106488:	e8 c7 fe ff ff       	call   80106354 <argfd>
8010648d:	85 c0                	test   %eax,%eax
8010648f:	78 35                	js     801064c6 <sys_read+0x5a>
80106491:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106494:	89 44 24 04          	mov    %eax,0x4(%esp)
80106498:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
8010649f:	e8 0e fd ff ff       	call   801061b2 <argint>
801064a4:	85 c0                	test   %eax,%eax
801064a6:	78 1e                	js     801064c6 <sys_read+0x5a>
801064a8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801064ab:	89 44 24 08          	mov    %eax,0x8(%esp)
801064af:	8d 45 ec             	lea    -0x14(%ebp),%eax
801064b2:	89 44 24 04          	mov    %eax,0x4(%esp)
801064b6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801064bd:	e8 28 fd ff ff       	call   801061ea <argptr>
801064c2:	85 c0                	test   %eax,%eax
801064c4:	79 07                	jns    801064cd <sys_read+0x61>
    return -1;
801064c6:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801064cb:	eb 19                	jmp    801064e6 <sys_read+0x7a>
  return fileread(f, p, n);
801064cd:	8b 4d f0             	mov    -0x10(%ebp),%ecx
801064d0:	8b 55 ec             	mov    -0x14(%ebp),%edx
801064d3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801064d6:	89 4c 24 08          	mov    %ecx,0x8(%esp)
801064da:	89 54 24 04          	mov    %edx,0x4(%esp)
801064de:	89 04 24             	mov    %eax,(%esp)
801064e1:	e8 17 ac ff ff       	call   801010fd <fileread>
}
801064e6:	c9                   	leave  
801064e7:	c3                   	ret    

801064e8 <sys_write>:

int
sys_write(void)
{
801064e8:	55                   	push   %ebp
801064e9:	89 e5                	mov    %esp,%ebp
801064eb:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
801064ee:	8d 45 f4             	lea    -0xc(%ebp),%eax
801064f1:	89 44 24 08          	mov    %eax,0x8(%esp)
801064f5:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801064fc:	00 
801064fd:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106504:	e8 4b fe ff ff       	call   80106354 <argfd>
80106509:	85 c0                	test   %eax,%eax
8010650b:	78 35                	js     80106542 <sys_write+0x5a>
8010650d:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106510:	89 44 24 04          	mov    %eax,0x4(%esp)
80106514:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
8010651b:	e8 92 fc ff ff       	call   801061b2 <argint>
80106520:	85 c0                	test   %eax,%eax
80106522:	78 1e                	js     80106542 <sys_write+0x5a>
80106524:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106527:	89 44 24 08          	mov    %eax,0x8(%esp)
8010652b:	8d 45 ec             	lea    -0x14(%ebp),%eax
8010652e:	89 44 24 04          	mov    %eax,0x4(%esp)
80106532:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80106539:	e8 ac fc ff ff       	call   801061ea <argptr>
8010653e:	85 c0                	test   %eax,%eax
80106540:	79 07                	jns    80106549 <sys_write+0x61>
    return -1;
80106542:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106547:	eb 19                	jmp    80106562 <sys_write+0x7a>
  return filewrite(f, p, n);
80106549:	8b 4d f0             	mov    -0x10(%ebp),%ecx
8010654c:	8b 55 ec             	mov    -0x14(%ebp),%edx
8010654f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106552:	89 4c 24 08          	mov    %ecx,0x8(%esp)
80106556:	89 54 24 04          	mov    %edx,0x4(%esp)
8010655a:	89 04 24             	mov    %eax,(%esp)
8010655d:	e8 57 ac ff ff       	call   801011b9 <filewrite>
}
80106562:	c9                   	leave  
80106563:	c3                   	ret    

80106564 <sys_close>:

int
sys_close(void)
{
80106564:	55                   	push   %ebp
80106565:	89 e5                	mov    %esp,%ebp
80106567:	83 ec 28             	sub    $0x28,%esp
  int fd;
  struct file *f;
  
  if(argfd(0, &fd, &f) < 0)
8010656a:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010656d:	89 44 24 08          	mov    %eax,0x8(%esp)
80106571:	8d 45 f4             	lea    -0xc(%ebp),%eax
80106574:	89 44 24 04          	mov    %eax,0x4(%esp)
80106578:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010657f:	e8 d0 fd ff ff       	call   80106354 <argfd>
80106584:	85 c0                	test   %eax,%eax
80106586:	79 07                	jns    8010658f <sys_close+0x2b>
    return -1;
80106588:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010658d:	eb 24                	jmp    801065b3 <sys_close+0x4f>
  proc->ofile[fd] = 0;
8010658f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106595:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106598:	83 c2 08             	add    $0x8,%edx
8010659b:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
801065a2:	00 
  fileclose(f);
801065a3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801065a6:	89 04 24             	mov    %eax,(%esp)
801065a9:	e8 2a aa ff ff       	call   80100fd8 <fileclose>
  return 0;
801065ae:	b8 00 00 00 00       	mov    $0x0,%eax
}
801065b3:	c9                   	leave  
801065b4:	c3                   	ret    

801065b5 <sys_fstat>:

int
sys_fstat(void)
{
801065b5:	55                   	push   %ebp
801065b6:	89 e5                	mov    %esp,%ebp
801065b8:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  struct stat *st;
  
  if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
801065bb:	8d 45 f4             	lea    -0xc(%ebp),%eax
801065be:	89 44 24 08          	mov    %eax,0x8(%esp)
801065c2:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801065c9:	00 
801065ca:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801065d1:	e8 7e fd ff ff       	call   80106354 <argfd>
801065d6:	85 c0                	test   %eax,%eax
801065d8:	78 1f                	js     801065f9 <sys_fstat+0x44>
801065da:	c7 44 24 08 14 00 00 	movl   $0x14,0x8(%esp)
801065e1:	00 
801065e2:	8d 45 f0             	lea    -0x10(%ebp),%eax
801065e5:	89 44 24 04          	mov    %eax,0x4(%esp)
801065e9:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801065f0:	e8 f5 fb ff ff       	call   801061ea <argptr>
801065f5:	85 c0                	test   %eax,%eax
801065f7:	79 07                	jns    80106600 <sys_fstat+0x4b>
    return -1;
801065f9:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801065fe:	eb 12                	jmp    80106612 <sys_fstat+0x5d>
  return filestat(f, st);
80106600:	8b 55 f0             	mov    -0x10(%ebp),%edx
80106603:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106606:	89 54 24 04          	mov    %edx,0x4(%esp)
8010660a:	89 04 24             	mov    %eax,(%esp)
8010660d:	e8 9c aa ff ff       	call   801010ae <filestat>
}
80106612:	c9                   	leave  
80106613:	c3                   	ret    

80106614 <sys_link>:

// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80106614:	55                   	push   %ebp
80106615:	89 e5                	mov    %esp,%ebp
80106617:	83 ec 38             	sub    $0x38,%esp
  char name[DIRSIZ], *new, *old;
  struct inode *dp, *ip;

  if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
8010661a:	8d 45 d8             	lea    -0x28(%ebp),%eax
8010661d:	89 44 24 04          	mov    %eax,0x4(%esp)
80106621:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106628:	e8 1f fc ff ff       	call   8010624c <argstr>
8010662d:	85 c0                	test   %eax,%eax
8010662f:	78 17                	js     80106648 <sys_link+0x34>
80106631:	8d 45 dc             	lea    -0x24(%ebp),%eax
80106634:	89 44 24 04          	mov    %eax,0x4(%esp)
80106638:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
8010663f:	e8 08 fc ff ff       	call   8010624c <argstr>
80106644:	85 c0                	test   %eax,%eax
80106646:	79 0a                	jns    80106652 <sys_link+0x3e>
    return -1;
80106648:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010664d:	e9 3c 01 00 00       	jmp    8010678e <sys_link+0x17a>
  if((ip = namei(old)) == 0)
80106652:	8b 45 d8             	mov    -0x28(%ebp),%eax
80106655:	89 04 24             	mov    %eax,(%esp)
80106658:	e8 d0 bd ff ff       	call   8010242d <namei>
8010665d:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106660:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106664:	75 0a                	jne    80106670 <sys_link+0x5c>
    return -1;
80106666:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010666b:	e9 1e 01 00 00       	jmp    8010678e <sys_link+0x17a>

  begin_trans();
80106670:	e8 17 cc ff ff       	call   8010328c <begin_trans>

  ilock(ip);
80106675:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106678:	89 04 24             	mov    %eax,(%esp)
8010667b:	e8 00 b2 ff ff       	call   80101880 <ilock>
  if(ip->type == T_DIR){
80106680:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106683:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80106687:	66 83 f8 01          	cmp    $0x1,%ax
8010668b:	75 1a                	jne    801066a7 <sys_link+0x93>
    iunlockput(ip);
8010668d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106690:	89 04 24             	mov    %eax,(%esp)
80106693:	e8 58 b4 ff ff       	call   80101af0 <iunlockput>
    commit_trans();
80106698:	e8 38 cc ff ff       	call   801032d5 <commit_trans>
    return -1;
8010669d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801066a2:	e9 e7 00 00 00       	jmp    8010678e <sys_link+0x17a>
  }

  ip->nlink++;
801066a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066aa:	0f b7 40 16          	movzwl 0x16(%eax),%eax
801066ae:	8d 50 01             	lea    0x1(%eax),%edx
801066b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066b4:	66 89 50 16          	mov    %dx,0x16(%eax)
  iupdate(ip);
801066b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066bb:	89 04 24             	mov    %eax,(%esp)
801066be:	e8 01 b0 ff ff       	call   801016c4 <iupdate>
  iunlock(ip);
801066c3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066c6:	89 04 24             	mov    %eax,(%esp)
801066c9:	e8 ec b2 ff ff       	call   801019ba <iunlock>

  if((dp = nameiparent(new, name)) == 0)
801066ce:	8b 45 dc             	mov    -0x24(%ebp),%eax
801066d1:	8d 55 e2             	lea    -0x1e(%ebp),%edx
801066d4:	89 54 24 04          	mov    %edx,0x4(%esp)
801066d8:	89 04 24             	mov    %eax,(%esp)
801066db:	e8 6f bd ff ff       	call   8010244f <nameiparent>
801066e0:	89 45 f0             	mov    %eax,-0x10(%ebp)
801066e3:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801066e7:	74 68                	je     80106751 <sys_link+0x13d>
    goto bad;
  ilock(dp);
801066e9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801066ec:	89 04 24             	mov    %eax,(%esp)
801066ef:	e8 8c b1 ff ff       	call   80101880 <ilock>
  if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
801066f4:	8b 45 f0             	mov    -0x10(%ebp),%eax
801066f7:	8b 10                	mov    (%eax),%edx
801066f9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066fc:	8b 00                	mov    (%eax),%eax
801066fe:	39 c2                	cmp    %eax,%edx
80106700:	75 20                	jne    80106722 <sys_link+0x10e>
80106702:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106705:	8b 40 04             	mov    0x4(%eax),%eax
80106708:	89 44 24 08          	mov    %eax,0x8(%esp)
8010670c:	8d 45 e2             	lea    -0x1e(%ebp),%eax
8010670f:	89 44 24 04          	mov    %eax,0x4(%esp)
80106713:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106716:	89 04 24             	mov    %eax,(%esp)
80106719:	e8 4c ba ff ff       	call   8010216a <dirlink>
8010671e:	85 c0                	test   %eax,%eax
80106720:	79 0d                	jns    8010672f <sys_link+0x11b>
    iunlockput(dp);
80106722:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106725:	89 04 24             	mov    %eax,(%esp)
80106728:	e8 c3 b3 ff ff       	call   80101af0 <iunlockput>
    goto bad;
8010672d:	eb 23                	jmp    80106752 <sys_link+0x13e>
  }
  iunlockput(dp);
8010672f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106732:	89 04 24             	mov    %eax,(%esp)
80106735:	e8 b6 b3 ff ff       	call   80101af0 <iunlockput>
  iput(ip);
8010673a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010673d:	89 04 24             	mov    %eax,(%esp)
80106740:	e8 da b2 ff ff       	call   80101a1f <iput>

  commit_trans();
80106745:	e8 8b cb ff ff       	call   801032d5 <commit_trans>

  return 0;
8010674a:	b8 00 00 00 00       	mov    $0x0,%eax
8010674f:	eb 3d                	jmp    8010678e <sys_link+0x17a>
  ip->nlink++;
  iupdate(ip);
  iunlock(ip);

  if((dp = nameiparent(new, name)) == 0)
    goto bad;
80106751:	90                   	nop
  commit_trans();

  return 0;

bad:
  ilock(ip);
80106752:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106755:	89 04 24             	mov    %eax,(%esp)
80106758:	e8 23 b1 ff ff       	call   80101880 <ilock>
  ip->nlink--;
8010675d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106760:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80106764:	8d 50 ff             	lea    -0x1(%eax),%edx
80106767:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010676a:	66 89 50 16          	mov    %dx,0x16(%eax)
  iupdate(ip);
8010676e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106771:	89 04 24             	mov    %eax,(%esp)
80106774:	e8 4b af ff ff       	call   801016c4 <iupdate>
  iunlockput(ip);
80106779:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010677c:	89 04 24             	mov    %eax,(%esp)
8010677f:	e8 6c b3 ff ff       	call   80101af0 <iunlockput>
  commit_trans();
80106784:	e8 4c cb ff ff       	call   801032d5 <commit_trans>
  return -1;
80106789:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
8010678e:	c9                   	leave  
8010678f:	c3                   	ret    

80106790 <isdirempty>:

// Is the directory dp empty except for "." and ".." ?
static int
isdirempty(struct inode *dp)
{
80106790:	55                   	push   %ebp
80106791:	89 e5                	mov    %esp,%ebp
80106793:	83 ec 38             	sub    $0x38,%esp
  int off;
  struct dirent de;

  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80106796:	c7 45 f4 20 00 00 00 	movl   $0x20,-0xc(%ebp)
8010679d:	eb 4b                	jmp    801067ea <isdirempty+0x5a>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
8010679f:	8b 45 f4             	mov    -0xc(%ebp),%eax
801067a2:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
801067a9:	00 
801067aa:	89 44 24 08          	mov    %eax,0x8(%esp)
801067ae:	8d 45 e4             	lea    -0x1c(%ebp),%eax
801067b1:	89 44 24 04          	mov    %eax,0x4(%esp)
801067b5:	8b 45 08             	mov    0x8(%ebp),%eax
801067b8:	89 04 24             	mov    %eax,(%esp)
801067bb:	e8 b9 b5 ff ff       	call   80101d79 <readi>
801067c0:	83 f8 10             	cmp    $0x10,%eax
801067c3:	74 0c                	je     801067d1 <isdirempty+0x41>
      panic("isdirempty: readi");
801067c5:	c7 04 24 f6 97 10 80 	movl   $0x801097f6,(%esp)
801067cc:	e8 61 9d ff ff       	call   80100532 <panic>
    if(de.inum != 0)
801067d1:	0f b7 45 e4          	movzwl -0x1c(%ebp),%eax
801067d5:	66 85 c0             	test   %ax,%ax
801067d8:	74 07                	je     801067e1 <isdirempty+0x51>
      return 0;
801067da:	b8 00 00 00 00       	mov    $0x0,%eax
801067df:	eb 1b                	jmp    801067fc <isdirempty+0x6c>
isdirempty(struct inode *dp)
{
  int off;
  struct dirent de;

  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
801067e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801067e4:	83 c0 10             	add    $0x10,%eax
801067e7:	89 45 f4             	mov    %eax,-0xc(%ebp)
801067ea:	8b 55 f4             	mov    -0xc(%ebp),%edx
801067ed:	8b 45 08             	mov    0x8(%ebp),%eax
801067f0:	8b 40 18             	mov    0x18(%eax),%eax
801067f3:	39 c2                	cmp    %eax,%edx
801067f5:	72 a8                	jb     8010679f <isdirempty+0xf>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("isdirempty: readi");
    if(de.inum != 0)
      return 0;
  }
  return 1;
801067f7:	b8 01 00 00 00       	mov    $0x1,%eax
}
801067fc:	c9                   	leave  
801067fd:	c3                   	ret    

801067fe <sys_unlink>:

//PAGEBREAK!
int
sys_unlink(void)
{
801067fe:	55                   	push   %ebp
801067ff:	89 e5                	mov    %esp,%ebp
80106801:	83 ec 48             	sub    $0x48,%esp
  struct inode *ip, *dp;
  struct dirent de;
  char name[DIRSIZ], *path;
  uint off;

  if(argstr(0, &path) < 0)
80106804:	8d 45 cc             	lea    -0x34(%ebp),%eax
80106807:	89 44 24 04          	mov    %eax,0x4(%esp)
8010680b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106812:	e8 35 fa ff ff       	call   8010624c <argstr>
80106817:	85 c0                	test   %eax,%eax
80106819:	79 0a                	jns    80106825 <sys_unlink+0x27>
    return -1;
8010681b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106820:	e9 aa 01 00 00       	jmp    801069cf <sys_unlink+0x1d1>
  if((dp = nameiparent(path, name)) == 0)
80106825:	8b 45 cc             	mov    -0x34(%ebp),%eax
80106828:	8d 55 d2             	lea    -0x2e(%ebp),%edx
8010682b:	89 54 24 04          	mov    %edx,0x4(%esp)
8010682f:	89 04 24             	mov    %eax,(%esp)
80106832:	e8 18 bc ff ff       	call   8010244f <nameiparent>
80106837:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010683a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010683e:	75 0a                	jne    8010684a <sys_unlink+0x4c>
    return -1;
80106840:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106845:	e9 85 01 00 00       	jmp    801069cf <sys_unlink+0x1d1>

  begin_trans();
8010684a:	e8 3d ca ff ff       	call   8010328c <begin_trans>

  ilock(dp);
8010684f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106852:	89 04 24             	mov    %eax,(%esp)
80106855:	e8 26 b0 ff ff       	call   80101880 <ilock>

  // Cannot unlink "." or "..".
  if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
8010685a:	c7 44 24 04 08 98 10 	movl   $0x80109808,0x4(%esp)
80106861:	80 
80106862:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80106865:	89 04 24             	mov    %eax,(%esp)
80106868:	e8 13 b8 ff ff       	call   80102080 <namecmp>
8010686d:	85 c0                	test   %eax,%eax
8010686f:	0f 84 45 01 00 00    	je     801069ba <sys_unlink+0x1bc>
80106875:	c7 44 24 04 0a 98 10 	movl   $0x8010980a,0x4(%esp)
8010687c:	80 
8010687d:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80106880:	89 04 24             	mov    %eax,(%esp)
80106883:	e8 f8 b7 ff ff       	call   80102080 <namecmp>
80106888:	85 c0                	test   %eax,%eax
8010688a:	0f 84 2a 01 00 00    	je     801069ba <sys_unlink+0x1bc>
    goto bad;

  if((ip = dirlookup(dp, name, &off)) == 0)
80106890:	8d 45 c8             	lea    -0x38(%ebp),%eax
80106893:	89 44 24 08          	mov    %eax,0x8(%esp)
80106897:	8d 45 d2             	lea    -0x2e(%ebp),%eax
8010689a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010689e:	8b 45 f4             	mov    -0xc(%ebp),%eax
801068a1:	89 04 24             	mov    %eax,(%esp)
801068a4:	e8 f9 b7 ff ff       	call   801020a2 <dirlookup>
801068a9:	89 45 f0             	mov    %eax,-0x10(%ebp)
801068ac:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801068b0:	0f 84 03 01 00 00    	je     801069b9 <sys_unlink+0x1bb>
    goto bad;
  ilock(ip);
801068b6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801068b9:	89 04 24             	mov    %eax,(%esp)
801068bc:	e8 bf af ff ff       	call   80101880 <ilock>

  if(ip->nlink < 1)
801068c1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801068c4:	0f b7 40 16          	movzwl 0x16(%eax),%eax
801068c8:	66 85 c0             	test   %ax,%ax
801068cb:	7f 0c                	jg     801068d9 <sys_unlink+0xdb>
    panic("unlink: nlink < 1");
801068cd:	c7 04 24 0d 98 10 80 	movl   $0x8010980d,(%esp)
801068d4:	e8 59 9c ff ff       	call   80100532 <panic>
  if(ip->type == T_DIR && !isdirempty(ip)){
801068d9:	8b 45 f0             	mov    -0x10(%ebp),%eax
801068dc:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801068e0:	66 83 f8 01          	cmp    $0x1,%ax
801068e4:	75 1f                	jne    80106905 <sys_unlink+0x107>
801068e6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801068e9:	89 04 24             	mov    %eax,(%esp)
801068ec:	e8 9f fe ff ff       	call   80106790 <isdirempty>
801068f1:	85 c0                	test   %eax,%eax
801068f3:	75 10                	jne    80106905 <sys_unlink+0x107>
    iunlockput(ip);
801068f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801068f8:	89 04 24             	mov    %eax,(%esp)
801068fb:	e8 f0 b1 ff ff       	call   80101af0 <iunlockput>
    goto bad;
80106900:	e9 b5 00 00 00       	jmp    801069ba <sys_unlink+0x1bc>
  }

  memset(&de, 0, sizeof(de));
80106905:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
8010690c:	00 
8010690d:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106914:	00 
80106915:	8d 45 e0             	lea    -0x20(%ebp),%eax
80106918:	89 04 24             	mov    %eax,(%esp)
8010691b:	e8 42 f5 ff ff       	call   80105e62 <memset>
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80106920:	8b 45 c8             	mov    -0x38(%ebp),%eax
80106923:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
8010692a:	00 
8010692b:	89 44 24 08          	mov    %eax,0x8(%esp)
8010692f:	8d 45 e0             	lea    -0x20(%ebp),%eax
80106932:	89 44 24 04          	mov    %eax,0x4(%esp)
80106936:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106939:	89 04 24             	mov    %eax,(%esp)
8010693c:	e8 a6 b5 ff ff       	call   80101ee7 <writei>
80106941:	83 f8 10             	cmp    $0x10,%eax
80106944:	74 0c                	je     80106952 <sys_unlink+0x154>
    panic("unlink: writei");
80106946:	c7 04 24 1f 98 10 80 	movl   $0x8010981f,(%esp)
8010694d:	e8 e0 9b ff ff       	call   80100532 <panic>
  if(ip->type == T_DIR){
80106952:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106955:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80106959:	66 83 f8 01          	cmp    $0x1,%ax
8010695d:	75 1c                	jne    8010697b <sys_unlink+0x17d>
    dp->nlink--;
8010695f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106962:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80106966:	8d 50 ff             	lea    -0x1(%eax),%edx
80106969:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010696c:	66 89 50 16          	mov    %dx,0x16(%eax)
    iupdate(dp);
80106970:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106973:	89 04 24             	mov    %eax,(%esp)
80106976:	e8 49 ad ff ff       	call   801016c4 <iupdate>
  }
  iunlockput(dp);
8010697b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010697e:	89 04 24             	mov    %eax,(%esp)
80106981:	e8 6a b1 ff ff       	call   80101af0 <iunlockput>

  ip->nlink--;
80106986:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106989:	0f b7 40 16          	movzwl 0x16(%eax),%eax
8010698d:	8d 50 ff             	lea    -0x1(%eax),%edx
80106990:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106993:	66 89 50 16          	mov    %dx,0x16(%eax)
  iupdate(ip);
80106997:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010699a:	89 04 24             	mov    %eax,(%esp)
8010699d:	e8 22 ad ff ff       	call   801016c4 <iupdate>
  iunlockput(ip);
801069a2:	8b 45 f0             	mov    -0x10(%ebp),%eax
801069a5:	89 04 24             	mov    %eax,(%esp)
801069a8:	e8 43 b1 ff ff       	call   80101af0 <iunlockput>

  commit_trans();
801069ad:	e8 23 c9 ff ff       	call   801032d5 <commit_trans>

  return 0;
801069b2:	b8 00 00 00 00       	mov    $0x0,%eax
801069b7:	eb 16                	jmp    801069cf <sys_unlink+0x1d1>
  // Cannot unlink "." or "..".
  if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
    goto bad;

  if((ip = dirlookup(dp, name, &off)) == 0)
    goto bad;
801069b9:	90                   	nop
  commit_trans();

  return 0;

bad:
  iunlockput(dp);
801069ba:	8b 45 f4             	mov    -0xc(%ebp),%eax
801069bd:	89 04 24             	mov    %eax,(%esp)
801069c0:	e8 2b b1 ff ff       	call   80101af0 <iunlockput>
  commit_trans();
801069c5:	e8 0b c9 ff ff       	call   801032d5 <commit_trans>
  return -1;
801069ca:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
801069cf:	c9                   	leave  
801069d0:	c3                   	ret    

801069d1 <create>:

static struct inode*
create(char *path, short type, short major, short minor)
{
801069d1:	55                   	push   %ebp
801069d2:	89 e5                	mov    %esp,%ebp
801069d4:	83 ec 48             	sub    $0x48,%esp
801069d7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
801069da:	8b 55 10             	mov    0x10(%ebp),%edx
801069dd:	8b 45 14             	mov    0x14(%ebp),%eax
801069e0:	66 89 4d d4          	mov    %cx,-0x2c(%ebp)
801069e4:	66 89 55 d0          	mov    %dx,-0x30(%ebp)
801069e8:	66 89 45 cc          	mov    %ax,-0x34(%ebp)
  uint off;
  struct inode *ip, *dp;
  char name[DIRSIZ];

  if((dp = nameiparent(path, name)) == 0)
801069ec:	8d 45 de             	lea    -0x22(%ebp),%eax
801069ef:	89 44 24 04          	mov    %eax,0x4(%esp)
801069f3:	8b 45 08             	mov    0x8(%ebp),%eax
801069f6:	89 04 24             	mov    %eax,(%esp)
801069f9:	e8 51 ba ff ff       	call   8010244f <nameiparent>
801069fe:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106a01:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106a05:	75 0a                	jne    80106a11 <create+0x40>
    return 0;
80106a07:	b8 00 00 00 00       	mov    $0x0,%eax
80106a0c:	e9 7e 01 00 00       	jmp    80106b8f <create+0x1be>
  ilock(dp);
80106a11:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106a14:	89 04 24             	mov    %eax,(%esp)
80106a17:	e8 64 ae ff ff       	call   80101880 <ilock>

  if((ip = dirlookup(dp, name, &off)) != 0){
80106a1c:	8d 45 ec             	lea    -0x14(%ebp),%eax
80106a1f:	89 44 24 08          	mov    %eax,0x8(%esp)
80106a23:	8d 45 de             	lea    -0x22(%ebp),%eax
80106a26:	89 44 24 04          	mov    %eax,0x4(%esp)
80106a2a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106a2d:	89 04 24             	mov    %eax,(%esp)
80106a30:	e8 6d b6 ff ff       	call   801020a2 <dirlookup>
80106a35:	89 45 f0             	mov    %eax,-0x10(%ebp)
80106a38:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80106a3c:	74 47                	je     80106a85 <create+0xb4>
    iunlockput(dp);
80106a3e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106a41:	89 04 24             	mov    %eax,(%esp)
80106a44:	e8 a7 b0 ff ff       	call   80101af0 <iunlockput>
    ilock(ip);
80106a49:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106a4c:	89 04 24             	mov    %eax,(%esp)
80106a4f:	e8 2c ae ff ff       	call   80101880 <ilock>
    if(type == T_FILE && ip->type == T_FILE)
80106a54:	66 83 7d d4 02       	cmpw   $0x2,-0x2c(%ebp)
80106a59:	75 15                	jne    80106a70 <create+0x9f>
80106a5b:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106a5e:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80106a62:	66 83 f8 02          	cmp    $0x2,%ax
80106a66:	75 08                	jne    80106a70 <create+0x9f>
      return ip;
80106a68:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106a6b:	e9 1f 01 00 00       	jmp    80106b8f <create+0x1be>
    iunlockput(ip);
80106a70:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106a73:	89 04 24             	mov    %eax,(%esp)
80106a76:	e8 75 b0 ff ff       	call   80101af0 <iunlockput>
    return 0;
80106a7b:	b8 00 00 00 00       	mov    $0x0,%eax
80106a80:	e9 0a 01 00 00       	jmp    80106b8f <create+0x1be>
  }

  if((ip = ialloc(dp->dev, type)) == 0)
80106a85:	0f bf 55 d4          	movswl -0x2c(%ebp),%edx
80106a89:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106a8c:	8b 00                	mov    (%eax),%eax
80106a8e:	89 54 24 04          	mov    %edx,0x4(%esp)
80106a92:	89 04 24             	mov    %eax,(%esp)
80106a95:	e8 4b ab ff ff       	call   801015e5 <ialloc>
80106a9a:	89 45 f0             	mov    %eax,-0x10(%ebp)
80106a9d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80106aa1:	75 0c                	jne    80106aaf <create+0xde>
    panic("create: ialloc");
80106aa3:	c7 04 24 2e 98 10 80 	movl   $0x8010982e,(%esp)
80106aaa:	e8 83 9a ff ff       	call   80100532 <panic>

  ilock(ip);
80106aaf:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106ab2:	89 04 24             	mov    %eax,(%esp)
80106ab5:	e8 c6 ad ff ff       	call   80101880 <ilock>
  ip->major = major;
80106aba:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106abd:	0f b7 55 d0          	movzwl -0x30(%ebp),%edx
80106ac1:	66 89 50 12          	mov    %dx,0x12(%eax)
  ip->minor = minor;
80106ac5:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106ac8:	0f b7 55 cc          	movzwl -0x34(%ebp),%edx
80106acc:	66 89 50 14          	mov    %dx,0x14(%eax)
  ip->nlink = 1;
80106ad0:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106ad3:	66 c7 40 16 01 00    	movw   $0x1,0x16(%eax)
  iupdate(ip);
80106ad9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106adc:	89 04 24             	mov    %eax,(%esp)
80106adf:	e8 e0 ab ff ff       	call   801016c4 <iupdate>

  if(type == T_DIR){  // Create . and .. entries.
80106ae4:	66 83 7d d4 01       	cmpw   $0x1,-0x2c(%ebp)
80106ae9:	75 6a                	jne    80106b55 <create+0x184>
    dp->nlink++;  // for ".."
80106aeb:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106aee:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80106af2:	8d 50 01             	lea    0x1(%eax),%edx
80106af5:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106af8:	66 89 50 16          	mov    %dx,0x16(%eax)
    iupdate(dp);
80106afc:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106aff:	89 04 24             	mov    %eax,(%esp)
80106b02:	e8 bd ab ff ff       	call   801016c4 <iupdate>
    // No ip->nlink++ for ".": avoid cyclic ref count.
    if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80106b07:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106b0a:	8b 40 04             	mov    0x4(%eax),%eax
80106b0d:	89 44 24 08          	mov    %eax,0x8(%esp)
80106b11:	c7 44 24 04 08 98 10 	movl   $0x80109808,0x4(%esp)
80106b18:	80 
80106b19:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106b1c:	89 04 24             	mov    %eax,(%esp)
80106b1f:	e8 46 b6 ff ff       	call   8010216a <dirlink>
80106b24:	85 c0                	test   %eax,%eax
80106b26:	78 21                	js     80106b49 <create+0x178>
80106b28:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106b2b:	8b 40 04             	mov    0x4(%eax),%eax
80106b2e:	89 44 24 08          	mov    %eax,0x8(%esp)
80106b32:	c7 44 24 04 0a 98 10 	movl   $0x8010980a,0x4(%esp)
80106b39:	80 
80106b3a:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106b3d:	89 04 24             	mov    %eax,(%esp)
80106b40:	e8 25 b6 ff ff       	call   8010216a <dirlink>
80106b45:	85 c0                	test   %eax,%eax
80106b47:	79 0c                	jns    80106b55 <create+0x184>
      panic("create dots");
80106b49:	c7 04 24 3d 98 10 80 	movl   $0x8010983d,(%esp)
80106b50:	e8 dd 99 ff ff       	call   80100532 <panic>
  }

  if(dirlink(dp, name, ip->inum) < 0)
80106b55:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106b58:	8b 40 04             	mov    0x4(%eax),%eax
80106b5b:	89 44 24 08          	mov    %eax,0x8(%esp)
80106b5f:	8d 45 de             	lea    -0x22(%ebp),%eax
80106b62:	89 44 24 04          	mov    %eax,0x4(%esp)
80106b66:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106b69:	89 04 24             	mov    %eax,(%esp)
80106b6c:	e8 f9 b5 ff ff       	call   8010216a <dirlink>
80106b71:	85 c0                	test   %eax,%eax
80106b73:	79 0c                	jns    80106b81 <create+0x1b0>
    panic("create: dirlink");
80106b75:	c7 04 24 49 98 10 80 	movl   $0x80109849,(%esp)
80106b7c:	e8 b1 99 ff ff       	call   80100532 <panic>

  iunlockput(dp);
80106b81:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106b84:	89 04 24             	mov    %eax,(%esp)
80106b87:	e8 64 af ff ff       	call   80101af0 <iunlockput>

  return ip;
80106b8c:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80106b8f:	c9                   	leave  
80106b90:	c3                   	ret    

80106b91 <sys_open>:

int
sys_open(void)
{
80106b91:	55                   	push   %ebp
80106b92:	89 e5                	mov    %esp,%ebp
80106b94:	83 ec 38             	sub    $0x38,%esp
  char *path;
  int fd, omode;
  struct file *f;
  struct inode *ip;

  if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80106b97:	8d 45 e8             	lea    -0x18(%ebp),%eax
80106b9a:	89 44 24 04          	mov    %eax,0x4(%esp)
80106b9e:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106ba5:	e8 a2 f6 ff ff       	call   8010624c <argstr>
80106baa:	85 c0                	test   %eax,%eax
80106bac:	78 17                	js     80106bc5 <sys_open+0x34>
80106bae:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80106bb1:	89 44 24 04          	mov    %eax,0x4(%esp)
80106bb5:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80106bbc:	e8 f1 f5 ff ff       	call   801061b2 <argint>
80106bc1:	85 c0                	test   %eax,%eax
80106bc3:	79 0a                	jns    80106bcf <sys_open+0x3e>
    return -1;
80106bc5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106bca:	e9 48 01 00 00       	jmp    80106d17 <sys_open+0x186>
  if(omode & O_CREATE){
80106bcf:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106bd2:	25 00 02 00 00       	and    $0x200,%eax
80106bd7:	85 c0                	test   %eax,%eax
80106bd9:	74 40                	je     80106c1b <sys_open+0x8a>
    begin_trans();
80106bdb:	e8 ac c6 ff ff       	call   8010328c <begin_trans>
    ip = create(path, T_FILE, 0, 0);
80106be0:	8b 45 e8             	mov    -0x18(%ebp),%eax
80106be3:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
80106bea:	00 
80106beb:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80106bf2:	00 
80106bf3:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
80106bfa:	00 
80106bfb:	89 04 24             	mov    %eax,(%esp)
80106bfe:	e8 ce fd ff ff       	call   801069d1 <create>
80106c03:	89 45 f4             	mov    %eax,-0xc(%ebp)
    commit_trans();
80106c06:	e8 ca c6 ff ff       	call   801032d5 <commit_trans>
    if(ip == 0)
80106c0b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106c0f:	75 5c                	jne    80106c6d <sys_open+0xdc>
      return -1;
80106c11:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106c16:	e9 fc 00 00 00       	jmp    80106d17 <sys_open+0x186>
  } else {
    if((ip = namei(path)) == 0)
80106c1b:	8b 45 e8             	mov    -0x18(%ebp),%eax
80106c1e:	89 04 24             	mov    %eax,(%esp)
80106c21:	e8 07 b8 ff ff       	call   8010242d <namei>
80106c26:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106c29:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106c2d:	75 0a                	jne    80106c39 <sys_open+0xa8>
      return -1;
80106c2f:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106c34:	e9 de 00 00 00       	jmp    80106d17 <sys_open+0x186>
    ilock(ip);
80106c39:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106c3c:	89 04 24             	mov    %eax,(%esp)
80106c3f:	e8 3c ac ff ff       	call   80101880 <ilock>
    if(ip->type == T_DIR && omode != O_RDONLY){
80106c44:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106c47:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80106c4b:	66 83 f8 01          	cmp    $0x1,%ax
80106c4f:	75 1c                	jne    80106c6d <sys_open+0xdc>
80106c51:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106c54:	85 c0                	test   %eax,%eax
80106c56:	74 15                	je     80106c6d <sys_open+0xdc>
      iunlockput(ip);
80106c58:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106c5b:	89 04 24             	mov    %eax,(%esp)
80106c5e:	e8 8d ae ff ff       	call   80101af0 <iunlockput>
      return -1;
80106c63:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106c68:	e9 aa 00 00 00       	jmp    80106d17 <sys_open+0x186>
    }
  }

  if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
80106c6d:	e8 be a2 ff ff       	call   80100f30 <filealloc>
80106c72:	89 45 f0             	mov    %eax,-0x10(%ebp)
80106c75:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80106c79:	74 14                	je     80106c8f <sys_open+0xfe>
80106c7b:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106c7e:	89 04 24             	mov    %eax,(%esp)
80106c81:	e8 43 f7 ff ff       	call   801063c9 <fdalloc>
80106c86:	89 45 ec             	mov    %eax,-0x14(%ebp)
80106c89:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80106c8d:	79 23                	jns    80106cb2 <sys_open+0x121>
    if(f)
80106c8f:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80106c93:	74 0b                	je     80106ca0 <sys_open+0x10f>
      fileclose(f);
80106c95:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106c98:	89 04 24             	mov    %eax,(%esp)
80106c9b:	e8 38 a3 ff ff       	call   80100fd8 <fileclose>
    iunlockput(ip);
80106ca0:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106ca3:	89 04 24             	mov    %eax,(%esp)
80106ca6:	e8 45 ae ff ff       	call   80101af0 <iunlockput>
    return -1;
80106cab:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106cb0:	eb 65                	jmp    80106d17 <sys_open+0x186>
  }
  iunlock(ip);
80106cb2:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106cb5:	89 04 24             	mov    %eax,(%esp)
80106cb8:	e8 fd ac ff ff       	call   801019ba <iunlock>

  f->type = FD_INODE;
80106cbd:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106cc0:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
  f->ip = ip;
80106cc6:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106cc9:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106ccc:	89 50 10             	mov    %edx,0x10(%eax)
  f->off = 0;
80106ccf:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106cd2:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
  f->readable = !(omode & O_WRONLY);
80106cd9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106cdc:	83 e0 01             	and    $0x1,%eax
80106cdf:	85 c0                	test   %eax,%eax
80106ce1:	0f 94 c0             	sete   %al
80106ce4:	89 c2                	mov    %eax,%edx
80106ce6:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106ce9:	88 50 08             	mov    %dl,0x8(%eax)
  f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80106cec:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106cef:	83 e0 01             	and    $0x1,%eax
80106cf2:	85 c0                	test   %eax,%eax
80106cf4:	75 0a                	jne    80106d00 <sys_open+0x16f>
80106cf6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106cf9:	83 e0 02             	and    $0x2,%eax
80106cfc:	85 c0                	test   %eax,%eax
80106cfe:	74 07                	je     80106d07 <sys_open+0x176>
80106d00:	b8 01 00 00 00       	mov    $0x1,%eax
80106d05:	eb 05                	jmp    80106d0c <sys_open+0x17b>
80106d07:	b8 00 00 00 00       	mov    $0x0,%eax
80106d0c:	89 c2                	mov    %eax,%edx
80106d0e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106d11:	88 50 09             	mov    %dl,0x9(%eax)
  return fd;
80106d14:	8b 45 ec             	mov    -0x14(%ebp),%eax
}
80106d17:	c9                   	leave  
80106d18:	c3                   	ret    

80106d19 <sys_mkdir>:

int
sys_mkdir(void)
{
80106d19:	55                   	push   %ebp
80106d1a:	89 e5                	mov    %esp,%ebp
80106d1c:	83 ec 28             	sub    $0x28,%esp
  char *path;
  struct inode *ip;

  begin_trans();
80106d1f:	e8 68 c5 ff ff       	call   8010328c <begin_trans>
  if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
80106d24:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106d27:	89 44 24 04          	mov    %eax,0x4(%esp)
80106d2b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106d32:	e8 15 f5 ff ff       	call   8010624c <argstr>
80106d37:	85 c0                	test   %eax,%eax
80106d39:	78 2c                	js     80106d67 <sys_mkdir+0x4e>
80106d3b:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106d3e:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
80106d45:	00 
80106d46:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80106d4d:	00 
80106d4e:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80106d55:	00 
80106d56:	89 04 24             	mov    %eax,(%esp)
80106d59:	e8 73 fc ff ff       	call   801069d1 <create>
80106d5e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106d61:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106d65:	75 0c                	jne    80106d73 <sys_mkdir+0x5a>
    commit_trans();
80106d67:	e8 69 c5 ff ff       	call   801032d5 <commit_trans>
    return -1;
80106d6c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106d71:	eb 15                	jmp    80106d88 <sys_mkdir+0x6f>
  }
  iunlockput(ip);
80106d73:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106d76:	89 04 24             	mov    %eax,(%esp)
80106d79:	e8 72 ad ff ff       	call   80101af0 <iunlockput>
  commit_trans();
80106d7e:	e8 52 c5 ff ff       	call   801032d5 <commit_trans>
  return 0;
80106d83:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106d88:	c9                   	leave  
80106d89:	c3                   	ret    

80106d8a <sys_mknod>:

int
sys_mknod(void)
{
80106d8a:	55                   	push   %ebp
80106d8b:	89 e5                	mov    %esp,%ebp
80106d8d:	83 ec 38             	sub    $0x38,%esp
  struct inode *ip;
  char *path;
  int len;
  int major, minor;
  
  begin_trans();
80106d90:	e8 f7 c4 ff ff       	call   8010328c <begin_trans>
  if((len=argstr(0, &path)) < 0 ||
80106d95:	8d 45 ec             	lea    -0x14(%ebp),%eax
80106d98:	89 44 24 04          	mov    %eax,0x4(%esp)
80106d9c:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106da3:	e8 a4 f4 ff ff       	call   8010624c <argstr>
80106da8:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106dab:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106daf:	78 5e                	js     80106e0f <sys_mknod+0x85>
     argint(1, &major) < 0 ||
80106db1:	8d 45 e8             	lea    -0x18(%ebp),%eax
80106db4:	89 44 24 04          	mov    %eax,0x4(%esp)
80106db8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80106dbf:	e8 ee f3 ff ff       	call   801061b2 <argint>
  char *path;
  int len;
  int major, minor;
  
  begin_trans();
  if((len=argstr(0, &path)) < 0 ||
80106dc4:	85 c0                	test   %eax,%eax
80106dc6:	78 47                	js     80106e0f <sys_mknod+0x85>
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
80106dc8:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80106dcb:	89 44 24 04          	mov    %eax,0x4(%esp)
80106dcf:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
80106dd6:	e8 d7 f3 ff ff       	call   801061b2 <argint>
  int len;
  int major, minor;
  
  begin_trans();
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
80106ddb:	85 c0                	test   %eax,%eax
80106ddd:	78 30                	js     80106e0f <sys_mknod+0x85>
     argint(2, &minor) < 0 ||
     (ip = create(path, T_DEV, major, minor)) == 0){
80106ddf:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106de2:	0f bf c8             	movswl %ax,%ecx
80106de5:	8b 45 e8             	mov    -0x18(%ebp),%eax
80106de8:	0f bf d0             	movswl %ax,%edx
80106deb:	8b 45 ec             	mov    -0x14(%ebp),%eax
  int major, minor;
  
  begin_trans();
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
80106dee:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80106df2:	89 54 24 08          	mov    %edx,0x8(%esp)
80106df6:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
80106dfd:	00 
80106dfe:	89 04 24             	mov    %eax,(%esp)
80106e01:	e8 cb fb ff ff       	call   801069d1 <create>
80106e06:	89 45 f0             	mov    %eax,-0x10(%ebp)
80106e09:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80106e0d:	75 0c                	jne    80106e1b <sys_mknod+0x91>
     (ip = create(path, T_DEV, major, minor)) == 0){
    commit_trans();
80106e0f:	e8 c1 c4 ff ff       	call   801032d5 <commit_trans>
    return -1;
80106e14:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106e19:	eb 15                	jmp    80106e30 <sys_mknod+0xa6>
  }
  iunlockput(ip);
80106e1b:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106e1e:	89 04 24             	mov    %eax,(%esp)
80106e21:	e8 ca ac ff ff       	call   80101af0 <iunlockput>
  commit_trans();
80106e26:	e8 aa c4 ff ff       	call   801032d5 <commit_trans>
  return 0;
80106e2b:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106e30:	c9                   	leave  
80106e31:	c3                   	ret    

80106e32 <sys_chdir>:

int
sys_chdir(void)
{
80106e32:	55                   	push   %ebp
80106e33:	89 e5                	mov    %esp,%ebp
80106e35:	83 ec 28             	sub    $0x28,%esp
  char *path;
  struct inode *ip;

  if(argstr(0, &path) < 0 || (ip = namei(path)) == 0)
80106e38:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106e3b:	89 44 24 04          	mov    %eax,0x4(%esp)
80106e3f:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106e46:	e8 01 f4 ff ff       	call   8010624c <argstr>
80106e4b:	85 c0                	test   %eax,%eax
80106e4d:	78 14                	js     80106e63 <sys_chdir+0x31>
80106e4f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106e52:	89 04 24             	mov    %eax,(%esp)
80106e55:	e8 d3 b5 ff ff       	call   8010242d <namei>
80106e5a:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106e5d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106e61:	75 07                	jne    80106e6a <sys_chdir+0x38>
    return -1;
80106e63:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106e68:	eb 57                	jmp    80106ec1 <sys_chdir+0x8f>
  ilock(ip);
80106e6a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106e6d:	89 04 24             	mov    %eax,(%esp)
80106e70:	e8 0b aa ff ff       	call   80101880 <ilock>
  if(ip->type != T_DIR){
80106e75:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106e78:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80106e7c:	66 83 f8 01          	cmp    $0x1,%ax
80106e80:	74 12                	je     80106e94 <sys_chdir+0x62>
    iunlockput(ip);
80106e82:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106e85:	89 04 24             	mov    %eax,(%esp)
80106e88:	e8 63 ac ff ff       	call   80101af0 <iunlockput>
    return -1;
80106e8d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106e92:	eb 2d                	jmp    80106ec1 <sys_chdir+0x8f>
  }
  iunlock(ip);
80106e94:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106e97:	89 04 24             	mov    %eax,(%esp)
80106e9a:	e8 1b ab ff ff       	call   801019ba <iunlock>
  iput(proc->cwd);
80106e9f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106ea5:	8b 40 68             	mov    0x68(%eax),%eax
80106ea8:	89 04 24             	mov    %eax,(%esp)
80106eab:	e8 6f ab ff ff       	call   80101a1f <iput>
  proc->cwd = ip;
80106eb0:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106eb6:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106eb9:	89 50 68             	mov    %edx,0x68(%eax)
  return 0;
80106ebc:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106ec1:	c9                   	leave  
80106ec2:	c3                   	ret    

80106ec3 <sys_exec>:

int
sys_exec(void)
{
80106ec3:	55                   	push   %ebp
80106ec4:	89 e5                	mov    %esp,%ebp
80106ec6:	81 ec a8 00 00 00    	sub    $0xa8,%esp
  char *path, *argv[MAXARG];
  int i;
  uint uargv, uarg;

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
80106ecc:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106ecf:	89 44 24 04          	mov    %eax,0x4(%esp)
80106ed3:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106eda:	e8 6d f3 ff ff       	call   8010624c <argstr>
80106edf:	85 c0                	test   %eax,%eax
80106ee1:	78 1a                	js     80106efd <sys_exec+0x3a>
80106ee3:	8d 85 6c ff ff ff    	lea    -0x94(%ebp),%eax
80106ee9:	89 44 24 04          	mov    %eax,0x4(%esp)
80106eed:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80106ef4:	e8 b9 f2 ff ff       	call   801061b2 <argint>
80106ef9:	85 c0                	test   %eax,%eax
80106efb:	79 0a                	jns    80106f07 <sys_exec+0x44>
    return -1;
80106efd:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106f02:	e9 de 00 00 00       	jmp    80106fe5 <sys_exec+0x122>
  }
  memset(argv, 0, sizeof(argv));
80106f07:	c7 44 24 08 80 00 00 	movl   $0x80,0x8(%esp)
80106f0e:	00 
80106f0f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106f16:	00 
80106f17:	8d 85 70 ff ff ff    	lea    -0x90(%ebp),%eax
80106f1d:	89 04 24             	mov    %eax,(%esp)
80106f20:	e8 3d ef ff ff       	call   80105e62 <memset>
  for(i=0;; i++){
80106f25:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if(i >= NELEM(argv))
80106f2c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106f2f:	83 f8 1f             	cmp    $0x1f,%eax
80106f32:	76 0a                	jbe    80106f3e <sys_exec+0x7b>
      return -1;
80106f34:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106f39:	e9 a7 00 00 00       	jmp    80106fe5 <sys_exec+0x122>
    if(fetchint(proc, uargv+4*i, (int*)&uarg) < 0)
80106f3e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106f41:	c1 e0 02             	shl    $0x2,%eax
80106f44:	89 c2                	mov    %eax,%edx
80106f46:	8b 85 6c ff ff ff    	mov    -0x94(%ebp),%eax
80106f4c:	8d 0c 02             	lea    (%edx,%eax,1),%ecx
80106f4f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106f55:	8d 95 68 ff ff ff    	lea    -0x98(%ebp),%edx
80106f5b:	89 54 24 08          	mov    %edx,0x8(%esp)
80106f5f:	89 4c 24 04          	mov    %ecx,0x4(%esp)
80106f63:	89 04 24             	mov    %eax,(%esp)
80106f66:	e8 b5 f1 ff ff       	call   80106120 <fetchint>
80106f6b:	85 c0                	test   %eax,%eax
80106f6d:	79 07                	jns    80106f76 <sys_exec+0xb3>
      return -1;
80106f6f:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106f74:	eb 6f                	jmp    80106fe5 <sys_exec+0x122>
    if(uarg == 0){
80106f76:	8b 85 68 ff ff ff    	mov    -0x98(%ebp),%eax
80106f7c:	85 c0                	test   %eax,%eax
80106f7e:	75 26                	jne    80106fa6 <sys_exec+0xe3>
      argv[i] = 0;
80106f80:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106f83:	c7 84 85 70 ff ff ff 	movl   $0x0,-0x90(%ebp,%eax,4)
80106f8a:	00 00 00 00 
      break;
80106f8e:	90                   	nop
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
      return -1;
  }
  return exec(path, argv);
80106f8f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106f92:	8d 95 70 ff ff ff    	lea    -0x90(%ebp),%edx
80106f98:	89 54 24 04          	mov    %edx,0x4(%esp)
80106f9c:	89 04 24             	mov    %eax,(%esp)
80106f9f:	e8 50 9b ff ff       	call   80100af4 <exec>
80106fa4:	eb 3f                	jmp    80106fe5 <sys_exec+0x122>
      return -1;
    if(uarg == 0){
      argv[i] = 0;
      break;
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
80106fa6:	8d 85 70 ff ff ff    	lea    -0x90(%ebp),%eax
80106fac:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106faf:	c1 e2 02             	shl    $0x2,%edx
80106fb2:	8d 0c 10             	lea    (%eax,%edx,1),%ecx
80106fb5:	8b 95 68 ff ff ff    	mov    -0x98(%ebp),%edx
80106fbb:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106fc1:	89 4c 24 08          	mov    %ecx,0x8(%esp)
80106fc5:	89 54 24 04          	mov    %edx,0x4(%esp)
80106fc9:	89 04 24             	mov    %eax,(%esp)
80106fcc:	e8 83 f1 ff ff       	call   80106154 <fetchstr>
80106fd1:	85 c0                	test   %eax,%eax
80106fd3:	79 07                	jns    80106fdc <sys_exec+0x119>
      return -1;
80106fd5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106fda:	eb 09                	jmp    80106fe5 <sys_exec+0x122>

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
    return -1;
  }
  memset(argv, 0, sizeof(argv));
  for(i=0;; i++){
80106fdc:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
      argv[i] = 0;
      break;
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
      return -1;
  }
80106fe0:	e9 47 ff ff ff       	jmp    80106f2c <sys_exec+0x69>
  return exec(path, argv);
}
80106fe5:	c9                   	leave  
80106fe6:	c3                   	ret    

80106fe7 <sys_pipe>:

int
sys_pipe(void)
{
80106fe7:	55                   	push   %ebp
80106fe8:	89 e5                	mov    %esp,%ebp
80106fea:	83 ec 38             	sub    $0x38,%esp
  int *fd;
  struct file *rf, *wf;
  int fd0, fd1;

  if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
80106fed:	c7 44 24 08 08 00 00 	movl   $0x8,0x8(%esp)
80106ff4:	00 
80106ff5:	8d 45 ec             	lea    -0x14(%ebp),%eax
80106ff8:	89 44 24 04          	mov    %eax,0x4(%esp)
80106ffc:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80107003:	e8 e2 f1 ff ff       	call   801061ea <argptr>
80107008:	85 c0                	test   %eax,%eax
8010700a:	79 0a                	jns    80107016 <sys_pipe+0x2f>
    return -1;
8010700c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107011:	e9 9b 00 00 00       	jmp    801070b1 <sys_pipe+0xca>
  if(pipealloc(&rf, &wf) < 0)
80107016:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80107019:	89 44 24 04          	mov    %eax,0x4(%esp)
8010701d:	8d 45 e8             	lea    -0x18(%ebp),%eax
80107020:	89 04 24             	mov    %eax,(%esp)
80107023:	e8 9c cc ff ff       	call   80103cc4 <pipealloc>
80107028:	85 c0                	test   %eax,%eax
8010702a:	79 07                	jns    80107033 <sys_pipe+0x4c>
    return -1;
8010702c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107031:	eb 7e                	jmp    801070b1 <sys_pipe+0xca>
  fd0 = -1;
80107033:	c7 45 f4 ff ff ff ff 	movl   $0xffffffff,-0xc(%ebp)
  if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
8010703a:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010703d:	89 04 24             	mov    %eax,(%esp)
80107040:	e8 84 f3 ff ff       	call   801063c9 <fdalloc>
80107045:	89 45 f4             	mov    %eax,-0xc(%ebp)
80107048:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010704c:	78 14                	js     80107062 <sys_pipe+0x7b>
8010704e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80107051:	89 04 24             	mov    %eax,(%esp)
80107054:	e8 70 f3 ff ff       	call   801063c9 <fdalloc>
80107059:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010705c:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80107060:	79 37                	jns    80107099 <sys_pipe+0xb2>
    if(fd0 >= 0)
80107062:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80107066:	78 14                	js     8010707c <sys_pipe+0x95>
      proc->ofile[fd0] = 0;
80107068:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010706e:	8b 55 f4             	mov    -0xc(%ebp),%edx
80107071:	83 c2 08             	add    $0x8,%edx
80107074:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
8010707b:	00 
    fileclose(rf);
8010707c:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010707f:	89 04 24             	mov    %eax,(%esp)
80107082:	e8 51 9f ff ff       	call   80100fd8 <fileclose>
    fileclose(wf);
80107087:	8b 45 e4             	mov    -0x1c(%ebp),%eax
8010708a:	89 04 24             	mov    %eax,(%esp)
8010708d:	e8 46 9f ff ff       	call   80100fd8 <fileclose>
    return -1;
80107092:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107097:	eb 18                	jmp    801070b1 <sys_pipe+0xca>
  }
  fd[0] = fd0;
80107099:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010709c:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010709f:	89 10                	mov    %edx,(%eax)
  fd[1] = fd1;
801070a1:	8b 45 ec             	mov    -0x14(%ebp),%eax
801070a4:	8d 50 04             	lea    0x4(%eax),%edx
801070a7:	8b 45 f0             	mov    -0x10(%ebp),%eax
801070aa:	89 02                	mov    %eax,(%edx)
  return 0;
801070ac:	b8 00 00 00 00       	mov    $0x0,%eax
}
801070b1:	c9                   	leave  
801070b2:	c3                   	ret    
801070b3:	90                   	nop

801070b4 <sys_fork>:
#include "mmu.h"
#include "proc.h"

int
sys_fork(void)
{
801070b4:	55                   	push   %ebp
801070b5:	89 e5                	mov    %esp,%ebp
801070b7:	83 ec 08             	sub    $0x8,%esp
  return fork();
801070ba:	e8 e0 d2 ff ff       	call   8010439f <fork>
}
801070bf:	c9                   	leave  
801070c0:	c3                   	ret    

801070c1 <sys_exit>:

int
sys_exit(void)
{
801070c1:	55                   	push   %ebp
801070c2:	89 e5                	mov    %esp,%ebp
801070c4:	83 ec 08             	sub    $0x8,%esp
  exit();
801070c7:	e8 36 d4 ff ff       	call   80104502 <exit>
  return 0;  // not reached
801070cc:	b8 00 00 00 00       	mov    $0x0,%eax
}
801070d1:	c9                   	leave  
801070d2:	c3                   	ret    

801070d3 <sys_wait>:

int
sys_wait(void)
{
801070d3:	55                   	push   %ebp
801070d4:	89 e5                	mov    %esp,%ebp
801070d6:	83 ec 08             	sub    $0x8,%esp
  return wait();
801070d9:	e8 3f d5 ff ff       	call   8010461d <wait>
}
801070de:	c9                   	leave  
801070df:	c3                   	ret    

801070e0 <sys_kill>:

int
sys_kill(void)
{
801070e0:	55                   	push   %ebp
801070e1:	89 e5                	mov    %esp,%ebp
801070e3:	83 ec 28             	sub    $0x28,%esp
  int pid;

  if(argint(0, &pid) < 0)
801070e6:	8d 45 f4             	lea    -0xc(%ebp),%eax
801070e9:	89 44 24 04          	mov    %eax,0x4(%esp)
801070ed:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801070f4:	e8 b9 f0 ff ff       	call   801061b2 <argint>
801070f9:	85 c0                	test   %eax,%eax
801070fb:	79 07                	jns    80107104 <sys_kill+0x24>
    return -1;
801070fd:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107102:	eb 0b                	jmp    8010710f <sys_kill+0x2f>
  return kill(pid);
80107104:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107107:	89 04 24             	mov    %eax,(%esp)
8010710a:	e8 31 da ff ff       	call   80104b40 <kill>
}
8010710f:	c9                   	leave  
80107110:	c3                   	ret    

80107111 <sys_getpid>:

int
sys_getpid(void)
{
80107111:	55                   	push   %ebp
80107112:	89 e5                	mov    %esp,%ebp
  return proc->pid;
80107114:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010711a:	8b 40 10             	mov    0x10(%eax),%eax
}
8010711d:	5d                   	pop    %ebp
8010711e:	c3                   	ret    

8010711f <sys_sbrk>:

int
sys_sbrk(void)
{
8010711f:	55                   	push   %ebp
80107120:	89 e5                	mov    %esp,%ebp
80107122:	83 ec 28             	sub    $0x28,%esp
  int addr;
  int n;

  if(argint(0, &n) < 0)
80107125:	8d 45 f0             	lea    -0x10(%ebp),%eax
80107128:	89 44 24 04          	mov    %eax,0x4(%esp)
8010712c:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80107133:	e8 7a f0 ff ff       	call   801061b2 <argint>
80107138:	85 c0                	test   %eax,%eax
8010713a:	79 07                	jns    80107143 <sys_sbrk+0x24>
    return -1;
8010713c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107141:	eb 24                	jmp    80107167 <sys_sbrk+0x48>
  addr = proc->sz;
80107143:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80107149:	8b 00                	mov    (%eax),%eax
8010714b:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(growproc(n) < 0)
8010714e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107151:	89 04 24             	mov    %eax,(%esp)
80107154:	e8 a1 d1 ff ff       	call   801042fa <growproc>
80107159:	85 c0                	test   %eax,%eax
8010715b:	79 07                	jns    80107164 <sys_sbrk+0x45>
    return -1;
8010715d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107162:	eb 03                	jmp    80107167 <sys_sbrk+0x48>
  return addr;
80107164:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80107167:	c9                   	leave  
80107168:	c3                   	ret    

80107169 <sys_sleep>:

int
sys_sleep(void)
{
80107169:	55                   	push   %ebp
8010716a:	89 e5                	mov    %esp,%ebp
8010716c:	83 ec 28             	sub    $0x28,%esp
  int n;
  uint ticks0;
  
  if(argint(0, &n) < 0)
8010716f:	8d 45 f0             	lea    -0x10(%ebp),%eax
80107172:	89 44 24 04          	mov    %eax,0x4(%esp)
80107176:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010717d:	e8 30 f0 ff ff       	call   801061b2 <argint>
80107182:	85 c0                	test   %eax,%eax
80107184:	79 07                	jns    8010718d <sys_sleep+0x24>
    return -1;
80107186:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010718b:	eb 6c                	jmp    801071f9 <sys_sleep+0x90>
  acquire(&tickslock);
8010718d:	c7 04 24 00 72 11 80 	movl   $0x80117200,(%esp)
80107194:	e8 6e ea ff ff       	call   80105c07 <acquire>
  ticks0 = ticks;
80107199:	a1 40 7a 11 80       	mov    0x80117a40,%eax
8010719e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(ticks - ticks0 < n){
801071a1:	eb 34                	jmp    801071d7 <sys_sleep+0x6e>
    if(proc->killed){
801071a3:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801071a9:	8b 40 24             	mov    0x24(%eax),%eax
801071ac:	85 c0                	test   %eax,%eax
801071ae:	74 13                	je     801071c3 <sys_sleep+0x5a>
      release(&tickslock);
801071b0:	c7 04 24 00 72 11 80 	movl   $0x80117200,(%esp)
801071b7:	e8 ad ea ff ff       	call   80105c69 <release>
      return -1;
801071bc:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801071c1:	eb 36                	jmp    801071f9 <sys_sleep+0x90>
    }
    sleep(&ticks, &tickslock);
801071c3:	c7 44 24 04 00 72 11 	movl   $0x80117200,0x4(%esp)
801071ca:	80 
801071cb:	c7 04 24 40 7a 11 80 	movl   $0x80117a40,(%esp)
801071d2:	e8 fa d7 ff ff       	call   801049d1 <sleep>
  
  if(argint(0, &n) < 0)
    return -1;
  acquire(&tickslock);
  ticks0 = ticks;
  while(ticks - ticks0 < n){
801071d7:	a1 40 7a 11 80       	mov    0x80117a40,%eax
801071dc:	89 c2                	mov    %eax,%edx
801071de:	2b 55 f4             	sub    -0xc(%ebp),%edx
801071e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801071e4:	39 c2                	cmp    %eax,%edx
801071e6:	72 bb                	jb     801071a3 <sys_sleep+0x3a>
      release(&tickslock);
      return -1;
    }
    sleep(&ticks, &tickslock);
  }
  release(&tickslock);
801071e8:	c7 04 24 00 72 11 80 	movl   $0x80117200,(%esp)
801071ef:	e8 75 ea ff ff       	call   80105c69 <release>
  return 0;
801071f4:	b8 00 00 00 00       	mov    $0x0,%eax
}
801071f9:	c9                   	leave  
801071fa:	c3                   	ret    

801071fb <sys_uptime>:

// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
801071fb:	55                   	push   %ebp
801071fc:	89 e5                	mov    %esp,%ebp
801071fe:	83 ec 28             	sub    $0x28,%esp
  uint xticks;
  
  acquire(&tickslock);
80107201:	c7 04 24 00 72 11 80 	movl   $0x80117200,(%esp)
80107208:	e8 fa e9 ff ff       	call   80105c07 <acquire>
  xticks = ticks;
8010720d:	a1 40 7a 11 80       	mov    0x80117a40,%eax
80107212:	89 45 f4             	mov    %eax,-0xc(%ebp)
  release(&tickslock);
80107215:	c7 04 24 00 72 11 80 	movl   $0x80117200,(%esp)
8010721c:	e8 48 ea ff ff       	call   80105c69 <release>
  return xticks;
80107221:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80107224:	c9                   	leave  
80107225:	c3                   	ret    

80107226 <sys_enableSwapping>:

int sys_enableSwapping(void){
80107226:	55                   	push   %ebp
80107227:	89 e5                	mov    %esp,%ebp
80107229:	83 ec 08             	sub    $0x8,%esp
	return enableSwapping();
8010722c:	e8 e6 dc ff ff       	call   80104f17 <enableSwapping>
}
80107231:	c9                   	leave  
80107232:	c3                   	ret    

80107233 <sys_disableSwapping>:

int sys_disableSwapping(void){
80107233:	55                   	push   %ebp
80107234:	89 e5                	mov    %esp,%ebp
80107236:	83 ec 08             	sub    $0x8,%esp
	return disableSwapping();
80107239:	e8 ed dc ff ff       	call   80104f2b <disableSwapping>
}
8010723e:	c9                   	leave  
8010723f:	c3                   	ret    

80107240 <sys_shmget>:

int sys_shmget(void)
{
80107240:	55                   	push   %ebp
80107241:	89 e5                	mov    %esp,%ebp
80107243:	83 ec 28             	sub    $0x28,%esp
  int key, flg, sz;
  argint(0, &key);
80107246:	8d 45 f4             	lea    -0xc(%ebp),%eax
80107249:	89 44 24 04          	mov    %eax,0x4(%esp)
8010724d:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80107254:	e8 59 ef ff ff       	call   801061b2 <argint>
  argint(1, &sz);
80107259:	8d 45 ec             	lea    -0x14(%ebp),%eax
8010725c:	89 44 24 04          	mov    %eax,0x4(%esp)
80107260:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80107267:	e8 46 ef ff ff       	call   801061b2 <argint>
  argint(2, &flg);
8010726c:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010726f:	89 44 24 04          	mov    %eax,0x4(%esp)
80107273:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
8010727a:	e8 33 ef ff ff       	call   801061b2 <argint>

  return shmget(key,sz,flg);
8010727f:	8b 4d f0             	mov    -0x10(%ebp),%ecx
80107282:	8b 45 ec             	mov    -0x14(%ebp),%eax
80107285:	89 c2                	mov    %eax,%edx
80107287:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010728a:	89 4c 24 08          	mov    %ecx,0x8(%esp)
8010728e:	89 54 24 04          	mov    %edx,0x4(%esp)
80107292:	89 04 24             	mov    %eax,(%esp)
80107295:	e8 a5 dc ff ff       	call   80104f3f <shmget>
}
8010729a:	c9                   	leave  
8010729b:	c3                   	ret    

8010729c <sys_shmdel>:
int sys_shmdel(void)
{
8010729c:	55                   	push   %ebp
8010729d:	89 e5                	mov    %esp,%ebp
8010729f:	83 ec 28             	sub    $0x28,%esp
  int shmid;
  argint(0, &shmid);
801072a2:	8d 45 f4             	lea    -0xc(%ebp),%eax
801072a5:	89 44 24 04          	mov    %eax,0x4(%esp)
801072a9:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801072b0:	e8 fd ee ff ff       	call   801061b2 <argint>
  return shmdel(shmid);
801072b5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801072b8:	89 04 24             	mov    %eax,(%esp)
801072bb:	e8 c8 dd ff ff       	call   80105088 <shmdel>
}
801072c0:	c9                   	leave  
801072c1:	c3                   	ret    

801072c2 <sys_shmat>:
void* sys_shmat(void)
{
801072c2:	55                   	push   %ebp
801072c3:	89 e5                	mov    %esp,%ebp
801072c5:	83 ec 28             	sub    $0x28,%esp
  int shmid,shmflg;
  argint(0, &shmid);
801072c8:	8d 45 f4             	lea    -0xc(%ebp),%eax
801072cb:	89 44 24 04          	mov    %eax,0x4(%esp)
801072cf:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801072d6:	e8 d7 ee ff ff       	call   801061b2 <argint>
  argint(1, &shmflg);
801072db:	8d 45 f0             	lea    -0x10(%ebp),%eax
801072de:	89 44 24 04          	mov    %eax,0x4(%esp)
801072e2:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801072e9:	e8 c4 ee ff ff       	call   801061b2 <argint>
  return shmat(shmid,shmflg);
801072ee:	8b 55 f0             	mov    -0x10(%ebp),%edx
801072f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801072f4:	89 54 24 04          	mov    %edx,0x4(%esp)
801072f8:	89 04 24             	mov    %eax,(%esp)
801072fb:	e8 12 de ff ff       	call   80105112 <shmat>
}
80107300:	c9                   	leave  
80107301:	c3                   	ret    

80107302 <sys_shmdt>:
int sys_shmdt(void)
{
80107302:	55                   	push   %ebp
80107303:	89 e5                	mov    %esp,%ebp
80107305:	83 ec 28             	sub    $0x28,%esp
  void* shmaddr;
  argptr(0, (void*)&shmaddr, 2*sizeof(shmaddr[0]));
80107308:	c7 44 24 08 02 00 00 	movl   $0x2,0x8(%esp)
8010730f:	00 
80107310:	8d 45 f4             	lea    -0xc(%ebp),%eax
80107313:	89 44 24 04          	mov    %eax,0x4(%esp)
80107317:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010731e:	e8 c7 ee ff ff       	call   801061ea <argptr>
  return shmdt(shmaddr);
80107323:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107326:	89 04 24             	mov    %eax,(%esp)
80107329:	e8 9f df ff ff       	call   801052cd <shmdt>
}
8010732e:	c9                   	leave  
8010732f:	c3                   	ret    

80107330 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80107330:	55                   	push   %ebp
80107331:	89 e5                	mov    %esp,%ebp
80107333:	83 ec 08             	sub    $0x8,%esp
80107336:	8b 55 08             	mov    0x8(%ebp),%edx
80107339:	8b 45 0c             	mov    0xc(%ebp),%eax
8010733c:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80107340:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80107343:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80107347:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
8010734b:	ee                   	out    %al,(%dx)
}
8010734c:	c9                   	leave  
8010734d:	c3                   	ret    

8010734e <timerinit>:
#define TIMER_RATEGEN   0x04    // mode 2, rate generator
#define TIMER_16BIT     0x30    // r/w counter 16 bits, LSB first

void
timerinit(void)
{
8010734e:	55                   	push   %ebp
8010734f:	89 e5                	mov    %esp,%ebp
80107351:	83 ec 18             	sub    $0x18,%esp
  // Interrupt 100 times/sec.
  outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
80107354:	c7 44 24 04 34 00 00 	movl   $0x34,0x4(%esp)
8010735b:	00 
8010735c:	c7 04 24 43 00 00 00 	movl   $0x43,(%esp)
80107363:	e8 c8 ff ff ff       	call   80107330 <outb>
  outb(IO_TIMER1, TIMER_DIV(100) % 256);
80107368:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
8010736f:	00 
80107370:	c7 04 24 40 00 00 00 	movl   $0x40,(%esp)
80107377:	e8 b4 ff ff ff       	call   80107330 <outb>
  outb(IO_TIMER1, TIMER_DIV(100) / 256);
8010737c:	c7 44 24 04 2e 00 00 	movl   $0x2e,0x4(%esp)
80107383:	00 
80107384:	c7 04 24 40 00 00 00 	movl   $0x40,(%esp)
8010738b:	e8 a0 ff ff ff       	call   80107330 <outb>
  picenable(IRQ_TIMER);
80107390:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80107397:	e8 b1 c7 ff ff       	call   80103b4d <picenable>
}
8010739c:	c9                   	leave  
8010739d:	c3                   	ret    
8010739e:	66 90                	xchg   %ax,%ax

801073a0 <alltraps>:

  # vectors.S sends all traps here.
.globl alltraps
alltraps:
  # Build trap frame.
  pushl %ds
801073a0:	1e                   	push   %ds
  pushl %es
801073a1:	06                   	push   %es
  pushl %fs
801073a2:	0f a0                	push   %fs
  pushl %gs
801073a4:	0f a8                	push   %gs
  pushal
801073a6:	60                   	pusha  
  
  # Set up data and per-cpu segments.
  movw $(SEG_KDATA<<3), %ax
801073a7:	66 b8 10 00          	mov    $0x10,%ax
  movw %ax, %ds
801073ab:	8e d8                	mov    %eax,%ds
  movw %ax, %es
801073ad:	8e c0                	mov    %eax,%es
  movw $(SEG_KCPU<<3), %ax
801073af:	66 b8 18 00          	mov    $0x18,%ax
  movw %ax, %fs
801073b3:	8e e0                	mov    %eax,%fs
  movw %ax, %gs
801073b5:	8e e8                	mov    %eax,%gs

  # Call trap(tf), where tf=%esp
  pushl %esp
801073b7:	54                   	push   %esp
  call trap
801073b8:	e8 de 01 00 00       	call   8010759b <trap>
  addl $4, %esp
801073bd:	83 c4 04             	add    $0x4,%esp

801073c0 <trapret>:

  # Return falls through to trapret...
.globl trapret
trapret:
  popal
801073c0:	61                   	popa   
  popl %gs
801073c1:	0f a9                	pop    %gs
  popl %fs
801073c3:	0f a1                	pop    %fs
  popl %es
801073c5:	07                   	pop    %es
  popl %ds
801073c6:	1f                   	pop    %ds
  addl $0x8, %esp  # trapno and errcode
801073c7:	83 c4 08             	add    $0x8,%esp
  iret
801073ca:	cf                   	iret   
801073cb:	90                   	nop

801073cc <lidt>:

struct gatedesc;

static inline void
lidt(struct gatedesc *p, int size)
{
801073cc:	55                   	push   %ebp
801073cd:	89 e5                	mov    %esp,%ebp
801073cf:	83 ec 10             	sub    $0x10,%esp
  volatile ushort pd[3];

  pd[0] = size-1;
801073d2:	8b 45 0c             	mov    0xc(%ebp),%eax
801073d5:	83 e8 01             	sub    $0x1,%eax
801073d8:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
  pd[1] = (uint)p;
801073dc:	8b 45 08             	mov    0x8(%ebp),%eax
801073df:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  pd[2] = (uint)p >> 16;
801073e3:	8b 45 08             	mov    0x8(%ebp),%eax
801073e6:	c1 e8 10             	shr    $0x10,%eax
801073e9:	66 89 45 fe          	mov    %ax,-0x2(%ebp)

  asm volatile("lidt (%0)" : : "r" (pd));
801073ed:	8d 45 fa             	lea    -0x6(%ebp),%eax
801073f0:	0f 01 18             	lidtl  (%eax)
}
801073f3:	c9                   	leave  
801073f4:	c3                   	ret    

801073f5 <rcr2>:
  return result;
}

static inline uint
rcr2(void)
{
801073f5:	55                   	push   %ebp
801073f6:	89 e5                	mov    %esp,%ebp
801073f8:	53                   	push   %ebx
801073f9:	83 ec 10             	sub    $0x10,%esp
  uint val;
  asm volatile("movl %%cr2,%0" : "=r" (val));
801073fc:	0f 20 d3             	mov    %cr2,%ebx
801073ff:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return val;
80107402:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80107405:	83 c4 10             	add    $0x10,%esp
80107408:	5b                   	pop    %ebx
80107409:	5d                   	pop    %ebp
8010740a:	c3                   	ret    

8010740b <tvinit>:
struct spinlock tickslock;
uint ticks;

void
tvinit(void)
{
8010740b:	55                   	push   %ebp
8010740c:	89 e5                	mov    %esp,%ebp
8010740e:	83 ec 28             	sub    $0x28,%esp
  int i;

  for(i = 0; i < 256; i++)
80107411:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80107418:	e9 c3 00 00 00       	jmp    801074e0 <tvinit+0xd5>
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
8010741d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107420:	8b 04 85 f0 c0 10 80 	mov    -0x7fef3f10(,%eax,4),%eax
80107427:	89 c2                	mov    %eax,%edx
80107429:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010742c:	66 89 14 c5 40 72 11 	mov    %dx,-0x7fee8dc0(,%eax,8)
80107433:	80 
80107434:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107437:	66 c7 04 c5 42 72 11 	movw   $0x8,-0x7fee8dbe(,%eax,8)
8010743e:	80 08 00 
80107441:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107444:	0f b6 14 c5 44 72 11 	movzbl -0x7fee8dbc(,%eax,8),%edx
8010744b:	80 
8010744c:	83 e2 e0             	and    $0xffffffe0,%edx
8010744f:	88 14 c5 44 72 11 80 	mov    %dl,-0x7fee8dbc(,%eax,8)
80107456:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107459:	0f b6 14 c5 44 72 11 	movzbl -0x7fee8dbc(,%eax,8),%edx
80107460:	80 
80107461:	83 e2 1f             	and    $0x1f,%edx
80107464:	88 14 c5 44 72 11 80 	mov    %dl,-0x7fee8dbc(,%eax,8)
8010746b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010746e:	0f b6 14 c5 45 72 11 	movzbl -0x7fee8dbb(,%eax,8),%edx
80107475:	80 
80107476:	83 e2 f0             	and    $0xfffffff0,%edx
80107479:	83 ca 0e             	or     $0xe,%edx
8010747c:	88 14 c5 45 72 11 80 	mov    %dl,-0x7fee8dbb(,%eax,8)
80107483:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107486:	0f b6 14 c5 45 72 11 	movzbl -0x7fee8dbb(,%eax,8),%edx
8010748d:	80 
8010748e:	83 e2 ef             	and    $0xffffffef,%edx
80107491:	88 14 c5 45 72 11 80 	mov    %dl,-0x7fee8dbb(,%eax,8)
80107498:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010749b:	0f b6 14 c5 45 72 11 	movzbl -0x7fee8dbb(,%eax,8),%edx
801074a2:	80 
801074a3:	83 e2 9f             	and    $0xffffff9f,%edx
801074a6:	88 14 c5 45 72 11 80 	mov    %dl,-0x7fee8dbb(,%eax,8)
801074ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074b0:	0f b6 14 c5 45 72 11 	movzbl -0x7fee8dbb(,%eax,8),%edx
801074b7:	80 
801074b8:	83 ca 80             	or     $0xffffff80,%edx
801074bb:	88 14 c5 45 72 11 80 	mov    %dl,-0x7fee8dbb(,%eax,8)
801074c2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074c5:	8b 04 85 f0 c0 10 80 	mov    -0x7fef3f10(,%eax,4),%eax
801074cc:	c1 e8 10             	shr    $0x10,%eax
801074cf:	89 c2                	mov    %eax,%edx
801074d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801074d4:	66 89 14 c5 46 72 11 	mov    %dx,-0x7fee8dba(,%eax,8)
801074db:	80 
void
tvinit(void)
{
  int i;

  for(i = 0; i < 256; i++)
801074dc:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801074e0:	81 7d f4 ff 00 00 00 	cmpl   $0xff,-0xc(%ebp)
801074e7:	0f 8e 30 ff ff ff    	jle    8010741d <tvinit+0x12>
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
  SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801074ed:	a1 f0 c1 10 80       	mov    0x8010c1f0,%eax
801074f2:	66 a3 40 74 11 80    	mov    %ax,0x80117440
801074f8:	66 c7 05 42 74 11 80 	movw   $0x8,0x80117442
801074ff:	08 00 
80107501:	0f b6 05 44 74 11 80 	movzbl 0x80117444,%eax
80107508:	83 e0 e0             	and    $0xffffffe0,%eax
8010750b:	a2 44 74 11 80       	mov    %al,0x80117444
80107510:	0f b6 05 44 74 11 80 	movzbl 0x80117444,%eax
80107517:	83 e0 1f             	and    $0x1f,%eax
8010751a:	a2 44 74 11 80       	mov    %al,0x80117444
8010751f:	0f b6 05 45 74 11 80 	movzbl 0x80117445,%eax
80107526:	83 c8 0f             	or     $0xf,%eax
80107529:	a2 45 74 11 80       	mov    %al,0x80117445
8010752e:	0f b6 05 45 74 11 80 	movzbl 0x80117445,%eax
80107535:	83 e0 ef             	and    $0xffffffef,%eax
80107538:	a2 45 74 11 80       	mov    %al,0x80117445
8010753d:	0f b6 05 45 74 11 80 	movzbl 0x80117445,%eax
80107544:	83 c8 60             	or     $0x60,%eax
80107547:	a2 45 74 11 80       	mov    %al,0x80117445
8010754c:	0f b6 05 45 74 11 80 	movzbl 0x80117445,%eax
80107553:	83 c8 80             	or     $0xffffff80,%eax
80107556:	a2 45 74 11 80       	mov    %al,0x80117445
8010755b:	a1 f0 c1 10 80       	mov    0x8010c1f0,%eax
80107560:	c1 e8 10             	shr    $0x10,%eax
80107563:	66 a3 46 74 11 80    	mov    %ax,0x80117446
  
  initlock(&tickslock, "time");
80107569:	c7 44 24 04 5c 98 10 	movl   $0x8010985c,0x4(%esp)
80107570:	80 
80107571:	c7 04 24 00 72 11 80 	movl   $0x80117200,(%esp)
80107578:	e8 69 e6 ff ff       	call   80105be6 <initlock>
}
8010757d:	c9                   	leave  
8010757e:	c3                   	ret    

8010757f <idtinit>:

void
idtinit(void)
{
8010757f:	55                   	push   %ebp
80107580:	89 e5                	mov    %esp,%ebp
80107582:	83 ec 08             	sub    $0x8,%esp
  lidt(idt, sizeof(idt));
80107585:	c7 44 24 04 00 08 00 	movl   $0x800,0x4(%esp)
8010758c:	00 
8010758d:	c7 04 24 40 72 11 80 	movl   $0x80117240,(%esp)
80107594:	e8 33 fe ff ff       	call   801073cc <lidt>
}
80107599:	c9                   	leave  
8010759a:	c3                   	ret    

8010759b <trap>:

//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
8010759b:	55                   	push   %ebp
8010759c:	89 e5                	mov    %esp,%ebp
8010759e:	57                   	push   %edi
8010759f:	56                   	push   %esi
801075a0:	53                   	push   %ebx
801075a1:	83 ec 3c             	sub    $0x3c,%esp
  if(tf->trapno == T_SYSCALL){
801075a4:	8b 45 08             	mov    0x8(%ebp),%eax
801075a7:	8b 40 30             	mov    0x30(%eax),%eax
801075aa:	83 f8 40             	cmp    $0x40,%eax
801075ad:	75 3e                	jne    801075ed <trap+0x52>
    if(proc->killed)
801075af:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801075b5:	8b 40 24             	mov    0x24(%eax),%eax
801075b8:	85 c0                	test   %eax,%eax
801075ba:	74 05                	je     801075c1 <trap+0x26>
      exit();
801075bc:	e8 41 cf ff ff       	call   80104502 <exit>
    proc->tf = tf;
801075c1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801075c7:	8b 55 08             	mov    0x8(%ebp),%edx
801075ca:	89 50 18             	mov    %edx,0x18(%eax)
    syscall();
801075cd:	e8 bd ec ff ff       	call   8010628f <syscall>
    if(proc->killed)
801075d2:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801075d8:	8b 40 24             	mov    0x24(%eax),%eax
801075db:	85 c0                	test   %eax,%eax
801075dd:	0f 84 34 02 00 00    	je     80107817 <trap+0x27c>
      exit();
801075e3:	e8 1a cf ff ff       	call   80104502 <exit>
    return;
801075e8:	e9 2a 02 00 00       	jmp    80107817 <trap+0x27c>
  }

  switch(tf->trapno){
801075ed:	8b 45 08             	mov    0x8(%ebp),%eax
801075f0:	8b 40 30             	mov    0x30(%eax),%eax
801075f3:	83 e8 20             	sub    $0x20,%eax
801075f6:	83 f8 1f             	cmp    $0x1f,%eax
801075f9:	0f 87 bc 00 00 00    	ja     801076bb <trap+0x120>
801075ff:	8b 04 85 04 99 10 80 	mov    -0x7fef66fc(,%eax,4),%eax
80107606:	ff e0                	jmp    *%eax
  case T_IRQ0 + IRQ_TIMER:
    if(cpu->id == 0){
80107608:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010760e:	0f b6 00             	movzbl (%eax),%eax
80107611:	84 c0                	test   %al,%al
80107613:	75 31                	jne    80107646 <trap+0xab>
      acquire(&tickslock);
80107615:	c7 04 24 00 72 11 80 	movl   $0x80117200,(%esp)
8010761c:	e8 e6 e5 ff ff       	call   80105c07 <acquire>
      ticks++;
80107621:	a1 40 7a 11 80       	mov    0x80117a40,%eax
80107626:	83 c0 01             	add    $0x1,%eax
80107629:	a3 40 7a 11 80       	mov    %eax,0x80117a40
      wakeup(&ticks);
8010762e:	c7 04 24 40 7a 11 80 	movl   $0x80117a40,(%esp)
80107635:	e8 db d4 ff ff       	call   80104b15 <wakeup>
      release(&tickslock);
8010763a:	c7 04 24 00 72 11 80 	movl   $0x80117200,(%esp)
80107641:	e8 23 e6 ff ff       	call   80105c69 <release>
    }
    lapiceoi();
80107646:	e8 0a b9 ff ff       	call   80102f55 <lapiceoi>
    break;
8010764b:	e9 41 01 00 00       	jmp    80107791 <trap+0x1f6>
  case T_IRQ0 + IRQ_IDE:
    ideintr();
80107650:	e8 c6 b0 ff ff       	call   8010271b <ideintr>
    lapiceoi();
80107655:	e8 fb b8 ff ff       	call   80102f55 <lapiceoi>
    break;
8010765a:	e9 32 01 00 00       	jmp    80107791 <trap+0x1f6>
  case T_IRQ0 + IRQ_IDE+1:
    // Bochs generates spurious IDE1 interrupts.
    break;
  case T_IRQ0 + IRQ_KBD:
    kbdintr();
8010765f:	e8 cd b6 ff ff       	call   80102d31 <kbdintr>
    lapiceoi();
80107664:	e8 ec b8 ff ff       	call   80102f55 <lapiceoi>
    break;
80107669:	e9 23 01 00 00       	jmp    80107791 <trap+0x1f6>
  case T_IRQ0 + IRQ_COM1:
    uartintr();
8010766e:	e8 a9 03 00 00       	call   80107a1c <uartintr>
    lapiceoi();
80107673:	e8 dd b8 ff ff       	call   80102f55 <lapiceoi>
    break;
80107678:	e9 14 01 00 00       	jmp    80107791 <trap+0x1f6>
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
            cpu->id, tf->cs, tf->eip);
8010767d:	8b 45 08             	mov    0x8(%ebp),%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
80107680:	8b 48 38             	mov    0x38(%eax),%ecx
            cpu->id, tf->cs, tf->eip);
80107683:	8b 45 08             	mov    0x8(%ebp),%eax
80107686:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
8010768a:	0f b7 d0             	movzwl %ax,%edx
            cpu->id, tf->cs, tf->eip);
8010768d:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80107693:	0f b6 00             	movzbl (%eax),%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
80107696:	0f b6 c0             	movzbl %al,%eax
80107699:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
8010769d:	89 54 24 08          	mov    %edx,0x8(%esp)
801076a1:	89 44 24 04          	mov    %eax,0x4(%esp)
801076a5:	c7 04 24 64 98 10 80 	movl   $0x80109864,(%esp)
801076ac:	e8 e5 8c ff ff       	call   80100396 <cprintf>
            cpu->id, tf->cs, tf->eip);
    lapiceoi();
801076b1:	e8 9f b8 ff ff       	call   80102f55 <lapiceoi>
    break;
801076b6:	e9 d6 00 00 00       	jmp    80107791 <trap+0x1f6>
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
801076bb:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801076c1:	85 c0                	test   %eax,%eax
801076c3:	74 11                	je     801076d6 <trap+0x13b>
801076c5:	8b 45 08             	mov    0x8(%ebp),%eax
801076c8:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
801076cc:	0f b7 c0             	movzwl %ax,%eax
801076cf:	83 e0 03             	and    $0x3,%eax
801076d2:	85 c0                	test   %eax,%eax
801076d4:	75 46                	jne    8010771c <trap+0x181>
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801076d6:	e8 1a fd ff ff       	call   801073f5 <rcr2>
              tf->trapno, cpu->id, tf->eip, rcr2());
801076db:	8b 55 08             	mov    0x8(%ebp),%edx
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801076de:	8b 5a 38             	mov    0x38(%edx),%ebx
              tf->trapno, cpu->id, tf->eip, rcr2());
801076e1:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
801076e8:	0f b6 12             	movzbl (%edx),%edx
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801076eb:	0f b6 ca             	movzbl %dl,%ecx
              tf->trapno, cpu->id, tf->eip, rcr2());
801076ee:	8b 55 08             	mov    0x8(%ebp),%edx
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801076f1:	8b 52 30             	mov    0x30(%edx),%edx
801076f4:	89 44 24 10          	mov    %eax,0x10(%esp)
801076f8:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
801076fc:	89 4c 24 08          	mov    %ecx,0x8(%esp)
80107700:	89 54 24 04          	mov    %edx,0x4(%esp)
80107704:	c7 04 24 88 98 10 80 	movl   $0x80109888,(%esp)
8010770b:	e8 86 8c ff ff       	call   80100396 <cprintf>
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
80107710:	c7 04 24 ba 98 10 80 	movl   $0x801098ba,(%esp)
80107717:	e8 16 8e ff ff       	call   80100532 <panic>
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
8010771c:	e8 d4 fc ff ff       	call   801073f5 <rcr2>
80107721:	89 c2                	mov    %eax,%edx
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80107723:	8b 45 08             	mov    0x8(%ebp),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80107726:	8b 78 38             	mov    0x38(%eax),%edi
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80107729:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010772f:	0f b6 00             	movzbl (%eax),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80107732:	0f b6 f0             	movzbl %al,%esi
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80107735:	8b 45 08             	mov    0x8(%ebp),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80107738:	8b 58 34             	mov    0x34(%eax),%ebx
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
8010773b:	8b 45 08             	mov    0x8(%ebp),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
8010773e:	8b 48 30             	mov    0x30(%eax),%ecx
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80107741:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80107747:	83 c0 6c             	add    $0x6c,%eax
8010774a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
8010774d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80107753:	8b 40 10             	mov    0x10(%eax),%eax
80107756:	89 54 24 1c          	mov    %edx,0x1c(%esp)
8010775a:	89 7c 24 18          	mov    %edi,0x18(%esp)
8010775e:	89 74 24 14          	mov    %esi,0x14(%esp)
80107762:	89 5c 24 10          	mov    %ebx,0x10(%esp)
80107766:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
8010776a:	8b 55 e4             	mov    -0x1c(%ebp),%edx
8010776d:	89 54 24 08          	mov    %edx,0x8(%esp)
80107771:	89 44 24 04          	mov    %eax,0x4(%esp)
80107775:	c7 04 24 c0 98 10 80 	movl   $0x801098c0,(%esp)
8010777c:	e8 15 8c ff ff       	call   80100396 <cprintf>
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
            rcr2());
    proc->killed = 1;
80107781:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80107787:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
8010778e:	eb 01                	jmp    80107791 <trap+0x1f6>
    ideintr();
    lapiceoi();
    break;
  case T_IRQ0 + IRQ_IDE+1:
    // Bochs generates spurious IDE1 interrupts.
    break;
80107790:	90                   	nop
  }

  // Force process exit if it has been killed and is in user space.
  // (If it is still executing in the kernel, let it keep running 
  // until it gets to the regular system call return.)
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80107791:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80107797:	85 c0                	test   %eax,%eax
80107799:	74 24                	je     801077bf <trap+0x224>
8010779b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801077a1:	8b 40 24             	mov    0x24(%eax),%eax
801077a4:	85 c0                	test   %eax,%eax
801077a6:	74 17                	je     801077bf <trap+0x224>
801077a8:	8b 45 08             	mov    0x8(%ebp),%eax
801077ab:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
801077af:	0f b7 c0             	movzwl %ax,%eax
801077b2:	83 e0 03             	and    $0x3,%eax
801077b5:	83 f8 03             	cmp    $0x3,%eax
801077b8:	75 05                	jne    801077bf <trap+0x224>
    exit();
801077ba:	e8 43 cd ff ff       	call   80104502 <exit>

  // Force process to give up CPU on clock tick.
  // If interrupts were on while locks held, would need to check nlock.
  if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
801077bf:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801077c5:	85 c0                	test   %eax,%eax
801077c7:	74 1e                	je     801077e7 <trap+0x24c>
801077c9:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801077cf:	8b 40 0c             	mov    0xc(%eax),%eax
801077d2:	83 f8 04             	cmp    $0x4,%eax
801077d5:	75 10                	jne    801077e7 <trap+0x24c>
801077d7:	8b 45 08             	mov    0x8(%ebp),%eax
801077da:	8b 40 30             	mov    0x30(%eax),%eax
801077dd:	83 f8 20             	cmp    $0x20,%eax
801077e0:	75 05                	jne    801077e7 <trap+0x24c>
    yield();
801077e2:	e8 8c d1 ff ff       	call   80104973 <yield>

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
801077e7:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801077ed:	85 c0                	test   %eax,%eax
801077ef:	74 27                	je     80107818 <trap+0x27d>
801077f1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801077f7:	8b 40 24             	mov    0x24(%eax),%eax
801077fa:	85 c0                	test   %eax,%eax
801077fc:	74 1a                	je     80107818 <trap+0x27d>
801077fe:	8b 45 08             	mov    0x8(%ebp),%eax
80107801:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
80107805:	0f b7 c0             	movzwl %ax,%eax
80107808:	83 e0 03             	and    $0x3,%eax
8010780b:	83 f8 03             	cmp    $0x3,%eax
8010780e:	75 08                	jne    80107818 <trap+0x27d>
    exit();
80107810:	e8 ed cc ff ff       	call   80104502 <exit>
80107815:	eb 01                	jmp    80107818 <trap+0x27d>
      exit();
    proc->tf = tf;
    syscall();
    if(proc->killed)
      exit();
    return;
80107817:	90                   	nop
    yield();

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
    exit();
}
80107818:	83 c4 3c             	add    $0x3c,%esp
8010781b:	5b                   	pop    %ebx
8010781c:	5e                   	pop    %esi
8010781d:	5f                   	pop    %edi
8010781e:	5d                   	pop    %ebp
8010781f:	c3                   	ret    

80107820 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80107820:	55                   	push   %ebp
80107821:	89 e5                	mov    %esp,%ebp
80107823:	53                   	push   %ebx
80107824:	83 ec 14             	sub    $0x14,%esp
80107827:	8b 45 08             	mov    0x8(%ebp),%eax
8010782a:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010782e:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
80107832:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
80107836:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
8010783a:	ec                   	in     (%dx),%al
8010783b:	89 c3                	mov    %eax,%ebx
8010783d:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80107840:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
80107844:	83 c4 14             	add    $0x14,%esp
80107847:	5b                   	pop    %ebx
80107848:	5d                   	pop    %ebp
80107849:	c3                   	ret    

8010784a <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
8010784a:	55                   	push   %ebp
8010784b:	89 e5                	mov    %esp,%ebp
8010784d:	83 ec 08             	sub    $0x8,%esp
80107850:	8b 55 08             	mov    0x8(%ebp),%edx
80107853:	8b 45 0c             	mov    0xc(%ebp),%eax
80107856:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
8010785a:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010785d:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80107861:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80107865:	ee                   	out    %al,(%dx)
}
80107866:	c9                   	leave  
80107867:	c3                   	ret    

80107868 <uartinit>:

static int uart;    // is there a uart?

void
uartinit(void)
{
80107868:	55                   	push   %ebp
80107869:	89 e5                	mov    %esp,%ebp
8010786b:	83 ec 28             	sub    $0x28,%esp
  char *p;

  // Turn off the FIFO
  outb(COM1+2, 0);
8010786e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80107875:	00 
80107876:	c7 04 24 fa 03 00 00 	movl   $0x3fa,(%esp)
8010787d:	e8 c8 ff ff ff       	call   8010784a <outb>
  
  // 9600 baud, 8 data bits, 1 stop bit, parity off.
  outb(COM1+3, 0x80);    // Unlock divisor
80107882:	c7 44 24 04 80 00 00 	movl   $0x80,0x4(%esp)
80107889:	00 
8010788a:	c7 04 24 fb 03 00 00 	movl   $0x3fb,(%esp)
80107891:	e8 b4 ff ff ff       	call   8010784a <outb>
  outb(COM1+0, 115200/9600);
80107896:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
8010789d:	00 
8010789e:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
801078a5:	e8 a0 ff ff ff       	call   8010784a <outb>
  outb(COM1+1, 0);
801078aa:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801078b1:	00 
801078b2:	c7 04 24 f9 03 00 00 	movl   $0x3f9,(%esp)
801078b9:	e8 8c ff ff ff       	call   8010784a <outb>
  outb(COM1+3, 0x03);    // Lock divisor, 8 data bits.
801078be:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
801078c5:	00 
801078c6:	c7 04 24 fb 03 00 00 	movl   $0x3fb,(%esp)
801078cd:	e8 78 ff ff ff       	call   8010784a <outb>
  outb(COM1+4, 0);
801078d2:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801078d9:	00 
801078da:	c7 04 24 fc 03 00 00 	movl   $0x3fc,(%esp)
801078e1:	e8 64 ff ff ff       	call   8010784a <outb>
  outb(COM1+1, 0x01);    // Enable receive interrupts.
801078e6:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
801078ed:	00 
801078ee:	c7 04 24 f9 03 00 00 	movl   $0x3f9,(%esp)
801078f5:	e8 50 ff ff ff       	call   8010784a <outb>

  // If status is 0xFF, no serial port.
  if(inb(COM1+5) == 0xFF)
801078fa:	c7 04 24 fd 03 00 00 	movl   $0x3fd,(%esp)
80107901:	e8 1a ff ff ff       	call   80107820 <inb>
80107906:	3c ff                	cmp    $0xff,%al
80107908:	74 6c                	je     80107976 <uartinit+0x10e>
    return;
  uart = 1;
8010790a:	c7 05 b8 c6 10 80 01 	movl   $0x1,0x8010c6b8
80107911:	00 00 00 

  // Acknowledge pre-existing interrupt conditions;
  // enable interrupts.
  inb(COM1+2);
80107914:	c7 04 24 fa 03 00 00 	movl   $0x3fa,(%esp)
8010791b:	e8 00 ff ff ff       	call   80107820 <inb>
  inb(COM1+0);
80107920:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
80107927:	e8 f4 fe ff ff       	call   80107820 <inb>
  picenable(IRQ_COM1);
8010792c:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
80107933:	e8 15 c2 ff ff       	call   80103b4d <picenable>
  ioapicenable(IRQ_COM1, 0);
80107938:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010793f:	00 
80107940:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
80107947:	e8 36 b0 ff ff       	call   80102982 <ioapicenable>
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
8010794c:	c7 45 f4 84 99 10 80 	movl   $0x80109984,-0xc(%ebp)
80107953:	eb 15                	jmp    8010796a <uartinit+0x102>
    uartputc(*p);
80107955:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107958:	0f b6 00             	movzbl (%eax),%eax
8010795b:	0f be c0             	movsbl %al,%eax
8010795e:	89 04 24             	mov    %eax,(%esp)
80107961:	e8 13 00 00 00       	call   80107979 <uartputc>
  inb(COM1+0);
  picenable(IRQ_COM1);
  ioapicenable(IRQ_COM1, 0);
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
80107966:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010796a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010796d:	0f b6 00             	movzbl (%eax),%eax
80107970:	84 c0                	test   %al,%al
80107972:	75 e1                	jne    80107955 <uartinit+0xed>
80107974:	eb 01                	jmp    80107977 <uartinit+0x10f>
  outb(COM1+4, 0);
  outb(COM1+1, 0x01);    // Enable receive interrupts.

  // If status is 0xFF, no serial port.
  if(inb(COM1+5) == 0xFF)
    return;
80107976:	90                   	nop
  ioapicenable(IRQ_COM1, 0);
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
    uartputc(*p);
}
80107977:	c9                   	leave  
80107978:	c3                   	ret    

80107979 <uartputc>:

void
uartputc(int c)
{
80107979:	55                   	push   %ebp
8010797a:	89 e5                	mov    %esp,%ebp
8010797c:	83 ec 28             	sub    $0x28,%esp
  int i;

  if(!uart)
8010797f:	a1 b8 c6 10 80       	mov    0x8010c6b8,%eax
80107984:	85 c0                	test   %eax,%eax
80107986:	74 4d                	je     801079d5 <uartputc+0x5c>
    return;
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80107988:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010798f:	eb 10                	jmp    801079a1 <uartputc+0x28>
    microdelay(10);
80107991:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
80107998:	e8 dd b5 ff ff       	call   80102f7a <microdelay>
{
  int i;

  if(!uart)
    return;
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
8010799d:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801079a1:	83 7d f4 7f          	cmpl   $0x7f,-0xc(%ebp)
801079a5:	7f 16                	jg     801079bd <uartputc+0x44>
801079a7:	c7 04 24 fd 03 00 00 	movl   $0x3fd,(%esp)
801079ae:	e8 6d fe ff ff       	call   80107820 <inb>
801079b3:	0f b6 c0             	movzbl %al,%eax
801079b6:	83 e0 20             	and    $0x20,%eax
801079b9:	85 c0                	test   %eax,%eax
801079bb:	74 d4                	je     80107991 <uartputc+0x18>
    microdelay(10);
  outb(COM1+0, c);
801079bd:	8b 45 08             	mov    0x8(%ebp),%eax
801079c0:	0f b6 c0             	movzbl %al,%eax
801079c3:	89 44 24 04          	mov    %eax,0x4(%esp)
801079c7:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
801079ce:	e8 77 fe ff ff       	call   8010784a <outb>
801079d3:	eb 01                	jmp    801079d6 <uartputc+0x5d>
uartputc(int c)
{
  int i;

  if(!uart)
    return;
801079d5:	90                   	nop
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
    microdelay(10);
  outb(COM1+0, c);
}
801079d6:	c9                   	leave  
801079d7:	c3                   	ret    

801079d8 <uartgetc>:

static int
uartgetc(void)
{
801079d8:	55                   	push   %ebp
801079d9:	89 e5                	mov    %esp,%ebp
801079db:	83 ec 04             	sub    $0x4,%esp
  if(!uart)
801079de:	a1 b8 c6 10 80       	mov    0x8010c6b8,%eax
801079e3:	85 c0                	test   %eax,%eax
801079e5:	75 07                	jne    801079ee <uartgetc+0x16>
    return -1;
801079e7:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801079ec:	eb 2c                	jmp    80107a1a <uartgetc+0x42>
  if(!(inb(COM1+5) & 0x01))
801079ee:	c7 04 24 fd 03 00 00 	movl   $0x3fd,(%esp)
801079f5:	e8 26 fe ff ff       	call   80107820 <inb>
801079fa:	0f b6 c0             	movzbl %al,%eax
801079fd:	83 e0 01             	and    $0x1,%eax
80107a00:	85 c0                	test   %eax,%eax
80107a02:	75 07                	jne    80107a0b <uartgetc+0x33>
    return -1;
80107a04:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107a09:	eb 0f                	jmp    80107a1a <uartgetc+0x42>
  return inb(COM1+0);
80107a0b:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
80107a12:	e8 09 fe ff ff       	call   80107820 <inb>
80107a17:	0f b6 c0             	movzbl %al,%eax
}
80107a1a:	c9                   	leave  
80107a1b:	c3                   	ret    

80107a1c <uartintr>:

void
uartintr(void)
{
80107a1c:	55                   	push   %ebp
80107a1d:	89 e5                	mov    %esp,%ebp
80107a1f:	83 ec 18             	sub    $0x18,%esp
  consoleintr(uartgetc);
80107a22:	c7 04 24 d8 79 10 80 	movl   $0x801079d8,(%esp)
80107a29:	e8 74 8d ff ff       	call   801007a2 <consoleintr>
}
80107a2e:	c9                   	leave  
80107a2f:	c3                   	ret    

80107a30 <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
  pushl $0
80107a30:	6a 00                	push   $0x0
  pushl $0
80107a32:	6a 00                	push   $0x0
  jmp alltraps
80107a34:	e9 67 f9 ff ff       	jmp    801073a0 <alltraps>

80107a39 <vector1>:
.globl vector1
vector1:
  pushl $0
80107a39:	6a 00                	push   $0x0
  pushl $1
80107a3b:	6a 01                	push   $0x1
  jmp alltraps
80107a3d:	e9 5e f9 ff ff       	jmp    801073a0 <alltraps>

80107a42 <vector2>:
.globl vector2
vector2:
  pushl $0
80107a42:	6a 00                	push   $0x0
  pushl $2
80107a44:	6a 02                	push   $0x2
  jmp alltraps
80107a46:	e9 55 f9 ff ff       	jmp    801073a0 <alltraps>

80107a4b <vector3>:
.globl vector3
vector3:
  pushl $0
80107a4b:	6a 00                	push   $0x0
  pushl $3
80107a4d:	6a 03                	push   $0x3
  jmp alltraps
80107a4f:	e9 4c f9 ff ff       	jmp    801073a0 <alltraps>

80107a54 <vector4>:
.globl vector4
vector4:
  pushl $0
80107a54:	6a 00                	push   $0x0
  pushl $4
80107a56:	6a 04                	push   $0x4
  jmp alltraps
80107a58:	e9 43 f9 ff ff       	jmp    801073a0 <alltraps>

80107a5d <vector5>:
.globl vector5
vector5:
  pushl $0
80107a5d:	6a 00                	push   $0x0
  pushl $5
80107a5f:	6a 05                	push   $0x5
  jmp alltraps
80107a61:	e9 3a f9 ff ff       	jmp    801073a0 <alltraps>

80107a66 <vector6>:
.globl vector6
vector6:
  pushl $0
80107a66:	6a 00                	push   $0x0
  pushl $6
80107a68:	6a 06                	push   $0x6
  jmp alltraps
80107a6a:	e9 31 f9 ff ff       	jmp    801073a0 <alltraps>

80107a6f <vector7>:
.globl vector7
vector7:
  pushl $0
80107a6f:	6a 00                	push   $0x0
  pushl $7
80107a71:	6a 07                	push   $0x7
  jmp alltraps
80107a73:	e9 28 f9 ff ff       	jmp    801073a0 <alltraps>

80107a78 <vector8>:
.globl vector8
vector8:
  pushl $8
80107a78:	6a 08                	push   $0x8
  jmp alltraps
80107a7a:	e9 21 f9 ff ff       	jmp    801073a0 <alltraps>

80107a7f <vector9>:
.globl vector9
vector9:
  pushl $0
80107a7f:	6a 00                	push   $0x0
  pushl $9
80107a81:	6a 09                	push   $0x9
  jmp alltraps
80107a83:	e9 18 f9 ff ff       	jmp    801073a0 <alltraps>

80107a88 <vector10>:
.globl vector10
vector10:
  pushl $10
80107a88:	6a 0a                	push   $0xa
  jmp alltraps
80107a8a:	e9 11 f9 ff ff       	jmp    801073a0 <alltraps>

80107a8f <vector11>:
.globl vector11
vector11:
  pushl $11
80107a8f:	6a 0b                	push   $0xb
  jmp alltraps
80107a91:	e9 0a f9 ff ff       	jmp    801073a0 <alltraps>

80107a96 <vector12>:
.globl vector12
vector12:
  pushl $12
80107a96:	6a 0c                	push   $0xc
  jmp alltraps
80107a98:	e9 03 f9 ff ff       	jmp    801073a0 <alltraps>

80107a9d <vector13>:
.globl vector13
vector13:
  pushl $13
80107a9d:	6a 0d                	push   $0xd
  jmp alltraps
80107a9f:	e9 fc f8 ff ff       	jmp    801073a0 <alltraps>

80107aa4 <vector14>:
.globl vector14
vector14:
  pushl $14
80107aa4:	6a 0e                	push   $0xe
  jmp alltraps
80107aa6:	e9 f5 f8 ff ff       	jmp    801073a0 <alltraps>

80107aab <vector15>:
.globl vector15
vector15:
  pushl $0
80107aab:	6a 00                	push   $0x0
  pushl $15
80107aad:	6a 0f                	push   $0xf
  jmp alltraps
80107aaf:	e9 ec f8 ff ff       	jmp    801073a0 <alltraps>

80107ab4 <vector16>:
.globl vector16
vector16:
  pushl $0
80107ab4:	6a 00                	push   $0x0
  pushl $16
80107ab6:	6a 10                	push   $0x10
  jmp alltraps
80107ab8:	e9 e3 f8 ff ff       	jmp    801073a0 <alltraps>

80107abd <vector17>:
.globl vector17
vector17:
  pushl $17
80107abd:	6a 11                	push   $0x11
  jmp alltraps
80107abf:	e9 dc f8 ff ff       	jmp    801073a0 <alltraps>

80107ac4 <vector18>:
.globl vector18
vector18:
  pushl $0
80107ac4:	6a 00                	push   $0x0
  pushl $18
80107ac6:	6a 12                	push   $0x12
  jmp alltraps
80107ac8:	e9 d3 f8 ff ff       	jmp    801073a0 <alltraps>

80107acd <vector19>:
.globl vector19
vector19:
  pushl $0
80107acd:	6a 00                	push   $0x0
  pushl $19
80107acf:	6a 13                	push   $0x13
  jmp alltraps
80107ad1:	e9 ca f8 ff ff       	jmp    801073a0 <alltraps>

80107ad6 <vector20>:
.globl vector20
vector20:
  pushl $0
80107ad6:	6a 00                	push   $0x0
  pushl $20
80107ad8:	6a 14                	push   $0x14
  jmp alltraps
80107ada:	e9 c1 f8 ff ff       	jmp    801073a0 <alltraps>

80107adf <vector21>:
.globl vector21
vector21:
  pushl $0
80107adf:	6a 00                	push   $0x0
  pushl $21
80107ae1:	6a 15                	push   $0x15
  jmp alltraps
80107ae3:	e9 b8 f8 ff ff       	jmp    801073a0 <alltraps>

80107ae8 <vector22>:
.globl vector22
vector22:
  pushl $0
80107ae8:	6a 00                	push   $0x0
  pushl $22
80107aea:	6a 16                	push   $0x16
  jmp alltraps
80107aec:	e9 af f8 ff ff       	jmp    801073a0 <alltraps>

80107af1 <vector23>:
.globl vector23
vector23:
  pushl $0
80107af1:	6a 00                	push   $0x0
  pushl $23
80107af3:	6a 17                	push   $0x17
  jmp alltraps
80107af5:	e9 a6 f8 ff ff       	jmp    801073a0 <alltraps>

80107afa <vector24>:
.globl vector24
vector24:
  pushl $0
80107afa:	6a 00                	push   $0x0
  pushl $24
80107afc:	6a 18                	push   $0x18
  jmp alltraps
80107afe:	e9 9d f8 ff ff       	jmp    801073a0 <alltraps>

80107b03 <vector25>:
.globl vector25
vector25:
  pushl $0
80107b03:	6a 00                	push   $0x0
  pushl $25
80107b05:	6a 19                	push   $0x19
  jmp alltraps
80107b07:	e9 94 f8 ff ff       	jmp    801073a0 <alltraps>

80107b0c <vector26>:
.globl vector26
vector26:
  pushl $0
80107b0c:	6a 00                	push   $0x0
  pushl $26
80107b0e:	6a 1a                	push   $0x1a
  jmp alltraps
80107b10:	e9 8b f8 ff ff       	jmp    801073a0 <alltraps>

80107b15 <vector27>:
.globl vector27
vector27:
  pushl $0
80107b15:	6a 00                	push   $0x0
  pushl $27
80107b17:	6a 1b                	push   $0x1b
  jmp alltraps
80107b19:	e9 82 f8 ff ff       	jmp    801073a0 <alltraps>

80107b1e <vector28>:
.globl vector28
vector28:
  pushl $0
80107b1e:	6a 00                	push   $0x0
  pushl $28
80107b20:	6a 1c                	push   $0x1c
  jmp alltraps
80107b22:	e9 79 f8 ff ff       	jmp    801073a0 <alltraps>

80107b27 <vector29>:
.globl vector29
vector29:
  pushl $0
80107b27:	6a 00                	push   $0x0
  pushl $29
80107b29:	6a 1d                	push   $0x1d
  jmp alltraps
80107b2b:	e9 70 f8 ff ff       	jmp    801073a0 <alltraps>

80107b30 <vector30>:
.globl vector30
vector30:
  pushl $0
80107b30:	6a 00                	push   $0x0
  pushl $30
80107b32:	6a 1e                	push   $0x1e
  jmp alltraps
80107b34:	e9 67 f8 ff ff       	jmp    801073a0 <alltraps>

80107b39 <vector31>:
.globl vector31
vector31:
  pushl $0
80107b39:	6a 00                	push   $0x0
  pushl $31
80107b3b:	6a 1f                	push   $0x1f
  jmp alltraps
80107b3d:	e9 5e f8 ff ff       	jmp    801073a0 <alltraps>

80107b42 <vector32>:
.globl vector32
vector32:
  pushl $0
80107b42:	6a 00                	push   $0x0
  pushl $32
80107b44:	6a 20                	push   $0x20
  jmp alltraps
80107b46:	e9 55 f8 ff ff       	jmp    801073a0 <alltraps>

80107b4b <vector33>:
.globl vector33
vector33:
  pushl $0
80107b4b:	6a 00                	push   $0x0
  pushl $33
80107b4d:	6a 21                	push   $0x21
  jmp alltraps
80107b4f:	e9 4c f8 ff ff       	jmp    801073a0 <alltraps>

80107b54 <vector34>:
.globl vector34
vector34:
  pushl $0
80107b54:	6a 00                	push   $0x0
  pushl $34
80107b56:	6a 22                	push   $0x22
  jmp alltraps
80107b58:	e9 43 f8 ff ff       	jmp    801073a0 <alltraps>

80107b5d <vector35>:
.globl vector35
vector35:
  pushl $0
80107b5d:	6a 00                	push   $0x0
  pushl $35
80107b5f:	6a 23                	push   $0x23
  jmp alltraps
80107b61:	e9 3a f8 ff ff       	jmp    801073a0 <alltraps>

80107b66 <vector36>:
.globl vector36
vector36:
  pushl $0
80107b66:	6a 00                	push   $0x0
  pushl $36
80107b68:	6a 24                	push   $0x24
  jmp alltraps
80107b6a:	e9 31 f8 ff ff       	jmp    801073a0 <alltraps>

80107b6f <vector37>:
.globl vector37
vector37:
  pushl $0
80107b6f:	6a 00                	push   $0x0
  pushl $37
80107b71:	6a 25                	push   $0x25
  jmp alltraps
80107b73:	e9 28 f8 ff ff       	jmp    801073a0 <alltraps>

80107b78 <vector38>:
.globl vector38
vector38:
  pushl $0
80107b78:	6a 00                	push   $0x0
  pushl $38
80107b7a:	6a 26                	push   $0x26
  jmp alltraps
80107b7c:	e9 1f f8 ff ff       	jmp    801073a0 <alltraps>

80107b81 <vector39>:
.globl vector39
vector39:
  pushl $0
80107b81:	6a 00                	push   $0x0
  pushl $39
80107b83:	6a 27                	push   $0x27
  jmp alltraps
80107b85:	e9 16 f8 ff ff       	jmp    801073a0 <alltraps>

80107b8a <vector40>:
.globl vector40
vector40:
  pushl $0
80107b8a:	6a 00                	push   $0x0
  pushl $40
80107b8c:	6a 28                	push   $0x28
  jmp alltraps
80107b8e:	e9 0d f8 ff ff       	jmp    801073a0 <alltraps>

80107b93 <vector41>:
.globl vector41
vector41:
  pushl $0
80107b93:	6a 00                	push   $0x0
  pushl $41
80107b95:	6a 29                	push   $0x29
  jmp alltraps
80107b97:	e9 04 f8 ff ff       	jmp    801073a0 <alltraps>

80107b9c <vector42>:
.globl vector42
vector42:
  pushl $0
80107b9c:	6a 00                	push   $0x0
  pushl $42
80107b9e:	6a 2a                	push   $0x2a
  jmp alltraps
80107ba0:	e9 fb f7 ff ff       	jmp    801073a0 <alltraps>

80107ba5 <vector43>:
.globl vector43
vector43:
  pushl $0
80107ba5:	6a 00                	push   $0x0
  pushl $43
80107ba7:	6a 2b                	push   $0x2b
  jmp alltraps
80107ba9:	e9 f2 f7 ff ff       	jmp    801073a0 <alltraps>

80107bae <vector44>:
.globl vector44
vector44:
  pushl $0
80107bae:	6a 00                	push   $0x0
  pushl $44
80107bb0:	6a 2c                	push   $0x2c
  jmp alltraps
80107bb2:	e9 e9 f7 ff ff       	jmp    801073a0 <alltraps>

80107bb7 <vector45>:
.globl vector45
vector45:
  pushl $0
80107bb7:	6a 00                	push   $0x0
  pushl $45
80107bb9:	6a 2d                	push   $0x2d
  jmp alltraps
80107bbb:	e9 e0 f7 ff ff       	jmp    801073a0 <alltraps>

80107bc0 <vector46>:
.globl vector46
vector46:
  pushl $0
80107bc0:	6a 00                	push   $0x0
  pushl $46
80107bc2:	6a 2e                	push   $0x2e
  jmp alltraps
80107bc4:	e9 d7 f7 ff ff       	jmp    801073a0 <alltraps>

80107bc9 <vector47>:
.globl vector47
vector47:
  pushl $0
80107bc9:	6a 00                	push   $0x0
  pushl $47
80107bcb:	6a 2f                	push   $0x2f
  jmp alltraps
80107bcd:	e9 ce f7 ff ff       	jmp    801073a0 <alltraps>

80107bd2 <vector48>:
.globl vector48
vector48:
  pushl $0
80107bd2:	6a 00                	push   $0x0
  pushl $48
80107bd4:	6a 30                	push   $0x30
  jmp alltraps
80107bd6:	e9 c5 f7 ff ff       	jmp    801073a0 <alltraps>

80107bdb <vector49>:
.globl vector49
vector49:
  pushl $0
80107bdb:	6a 00                	push   $0x0
  pushl $49
80107bdd:	6a 31                	push   $0x31
  jmp alltraps
80107bdf:	e9 bc f7 ff ff       	jmp    801073a0 <alltraps>

80107be4 <vector50>:
.globl vector50
vector50:
  pushl $0
80107be4:	6a 00                	push   $0x0
  pushl $50
80107be6:	6a 32                	push   $0x32
  jmp alltraps
80107be8:	e9 b3 f7 ff ff       	jmp    801073a0 <alltraps>

80107bed <vector51>:
.globl vector51
vector51:
  pushl $0
80107bed:	6a 00                	push   $0x0
  pushl $51
80107bef:	6a 33                	push   $0x33
  jmp alltraps
80107bf1:	e9 aa f7 ff ff       	jmp    801073a0 <alltraps>

80107bf6 <vector52>:
.globl vector52
vector52:
  pushl $0
80107bf6:	6a 00                	push   $0x0
  pushl $52
80107bf8:	6a 34                	push   $0x34
  jmp alltraps
80107bfa:	e9 a1 f7 ff ff       	jmp    801073a0 <alltraps>

80107bff <vector53>:
.globl vector53
vector53:
  pushl $0
80107bff:	6a 00                	push   $0x0
  pushl $53
80107c01:	6a 35                	push   $0x35
  jmp alltraps
80107c03:	e9 98 f7 ff ff       	jmp    801073a0 <alltraps>

80107c08 <vector54>:
.globl vector54
vector54:
  pushl $0
80107c08:	6a 00                	push   $0x0
  pushl $54
80107c0a:	6a 36                	push   $0x36
  jmp alltraps
80107c0c:	e9 8f f7 ff ff       	jmp    801073a0 <alltraps>

80107c11 <vector55>:
.globl vector55
vector55:
  pushl $0
80107c11:	6a 00                	push   $0x0
  pushl $55
80107c13:	6a 37                	push   $0x37
  jmp alltraps
80107c15:	e9 86 f7 ff ff       	jmp    801073a0 <alltraps>

80107c1a <vector56>:
.globl vector56
vector56:
  pushl $0
80107c1a:	6a 00                	push   $0x0
  pushl $56
80107c1c:	6a 38                	push   $0x38
  jmp alltraps
80107c1e:	e9 7d f7 ff ff       	jmp    801073a0 <alltraps>

80107c23 <vector57>:
.globl vector57
vector57:
  pushl $0
80107c23:	6a 00                	push   $0x0
  pushl $57
80107c25:	6a 39                	push   $0x39
  jmp alltraps
80107c27:	e9 74 f7 ff ff       	jmp    801073a0 <alltraps>

80107c2c <vector58>:
.globl vector58
vector58:
  pushl $0
80107c2c:	6a 00                	push   $0x0
  pushl $58
80107c2e:	6a 3a                	push   $0x3a
  jmp alltraps
80107c30:	e9 6b f7 ff ff       	jmp    801073a0 <alltraps>

80107c35 <vector59>:
.globl vector59
vector59:
  pushl $0
80107c35:	6a 00                	push   $0x0
  pushl $59
80107c37:	6a 3b                	push   $0x3b
  jmp alltraps
80107c39:	e9 62 f7 ff ff       	jmp    801073a0 <alltraps>

80107c3e <vector60>:
.globl vector60
vector60:
  pushl $0
80107c3e:	6a 00                	push   $0x0
  pushl $60
80107c40:	6a 3c                	push   $0x3c
  jmp alltraps
80107c42:	e9 59 f7 ff ff       	jmp    801073a0 <alltraps>

80107c47 <vector61>:
.globl vector61
vector61:
  pushl $0
80107c47:	6a 00                	push   $0x0
  pushl $61
80107c49:	6a 3d                	push   $0x3d
  jmp alltraps
80107c4b:	e9 50 f7 ff ff       	jmp    801073a0 <alltraps>

80107c50 <vector62>:
.globl vector62
vector62:
  pushl $0
80107c50:	6a 00                	push   $0x0
  pushl $62
80107c52:	6a 3e                	push   $0x3e
  jmp alltraps
80107c54:	e9 47 f7 ff ff       	jmp    801073a0 <alltraps>

80107c59 <vector63>:
.globl vector63
vector63:
  pushl $0
80107c59:	6a 00                	push   $0x0
  pushl $63
80107c5b:	6a 3f                	push   $0x3f
  jmp alltraps
80107c5d:	e9 3e f7 ff ff       	jmp    801073a0 <alltraps>

80107c62 <vector64>:
.globl vector64
vector64:
  pushl $0
80107c62:	6a 00                	push   $0x0
  pushl $64
80107c64:	6a 40                	push   $0x40
  jmp alltraps
80107c66:	e9 35 f7 ff ff       	jmp    801073a0 <alltraps>

80107c6b <vector65>:
.globl vector65
vector65:
  pushl $0
80107c6b:	6a 00                	push   $0x0
  pushl $65
80107c6d:	6a 41                	push   $0x41
  jmp alltraps
80107c6f:	e9 2c f7 ff ff       	jmp    801073a0 <alltraps>

80107c74 <vector66>:
.globl vector66
vector66:
  pushl $0
80107c74:	6a 00                	push   $0x0
  pushl $66
80107c76:	6a 42                	push   $0x42
  jmp alltraps
80107c78:	e9 23 f7 ff ff       	jmp    801073a0 <alltraps>

80107c7d <vector67>:
.globl vector67
vector67:
  pushl $0
80107c7d:	6a 00                	push   $0x0
  pushl $67
80107c7f:	6a 43                	push   $0x43
  jmp alltraps
80107c81:	e9 1a f7 ff ff       	jmp    801073a0 <alltraps>

80107c86 <vector68>:
.globl vector68
vector68:
  pushl $0
80107c86:	6a 00                	push   $0x0
  pushl $68
80107c88:	6a 44                	push   $0x44
  jmp alltraps
80107c8a:	e9 11 f7 ff ff       	jmp    801073a0 <alltraps>

80107c8f <vector69>:
.globl vector69
vector69:
  pushl $0
80107c8f:	6a 00                	push   $0x0
  pushl $69
80107c91:	6a 45                	push   $0x45
  jmp alltraps
80107c93:	e9 08 f7 ff ff       	jmp    801073a0 <alltraps>

80107c98 <vector70>:
.globl vector70
vector70:
  pushl $0
80107c98:	6a 00                	push   $0x0
  pushl $70
80107c9a:	6a 46                	push   $0x46
  jmp alltraps
80107c9c:	e9 ff f6 ff ff       	jmp    801073a0 <alltraps>

80107ca1 <vector71>:
.globl vector71
vector71:
  pushl $0
80107ca1:	6a 00                	push   $0x0
  pushl $71
80107ca3:	6a 47                	push   $0x47
  jmp alltraps
80107ca5:	e9 f6 f6 ff ff       	jmp    801073a0 <alltraps>

80107caa <vector72>:
.globl vector72
vector72:
  pushl $0
80107caa:	6a 00                	push   $0x0
  pushl $72
80107cac:	6a 48                	push   $0x48
  jmp alltraps
80107cae:	e9 ed f6 ff ff       	jmp    801073a0 <alltraps>

80107cb3 <vector73>:
.globl vector73
vector73:
  pushl $0
80107cb3:	6a 00                	push   $0x0
  pushl $73
80107cb5:	6a 49                	push   $0x49
  jmp alltraps
80107cb7:	e9 e4 f6 ff ff       	jmp    801073a0 <alltraps>

80107cbc <vector74>:
.globl vector74
vector74:
  pushl $0
80107cbc:	6a 00                	push   $0x0
  pushl $74
80107cbe:	6a 4a                	push   $0x4a
  jmp alltraps
80107cc0:	e9 db f6 ff ff       	jmp    801073a0 <alltraps>

80107cc5 <vector75>:
.globl vector75
vector75:
  pushl $0
80107cc5:	6a 00                	push   $0x0
  pushl $75
80107cc7:	6a 4b                	push   $0x4b
  jmp alltraps
80107cc9:	e9 d2 f6 ff ff       	jmp    801073a0 <alltraps>

80107cce <vector76>:
.globl vector76
vector76:
  pushl $0
80107cce:	6a 00                	push   $0x0
  pushl $76
80107cd0:	6a 4c                	push   $0x4c
  jmp alltraps
80107cd2:	e9 c9 f6 ff ff       	jmp    801073a0 <alltraps>

80107cd7 <vector77>:
.globl vector77
vector77:
  pushl $0
80107cd7:	6a 00                	push   $0x0
  pushl $77
80107cd9:	6a 4d                	push   $0x4d
  jmp alltraps
80107cdb:	e9 c0 f6 ff ff       	jmp    801073a0 <alltraps>

80107ce0 <vector78>:
.globl vector78
vector78:
  pushl $0
80107ce0:	6a 00                	push   $0x0
  pushl $78
80107ce2:	6a 4e                	push   $0x4e
  jmp alltraps
80107ce4:	e9 b7 f6 ff ff       	jmp    801073a0 <alltraps>

80107ce9 <vector79>:
.globl vector79
vector79:
  pushl $0
80107ce9:	6a 00                	push   $0x0
  pushl $79
80107ceb:	6a 4f                	push   $0x4f
  jmp alltraps
80107ced:	e9 ae f6 ff ff       	jmp    801073a0 <alltraps>

80107cf2 <vector80>:
.globl vector80
vector80:
  pushl $0
80107cf2:	6a 00                	push   $0x0
  pushl $80
80107cf4:	6a 50                	push   $0x50
  jmp alltraps
80107cf6:	e9 a5 f6 ff ff       	jmp    801073a0 <alltraps>

80107cfb <vector81>:
.globl vector81
vector81:
  pushl $0
80107cfb:	6a 00                	push   $0x0
  pushl $81
80107cfd:	6a 51                	push   $0x51
  jmp alltraps
80107cff:	e9 9c f6 ff ff       	jmp    801073a0 <alltraps>

80107d04 <vector82>:
.globl vector82
vector82:
  pushl $0
80107d04:	6a 00                	push   $0x0
  pushl $82
80107d06:	6a 52                	push   $0x52
  jmp alltraps
80107d08:	e9 93 f6 ff ff       	jmp    801073a0 <alltraps>

80107d0d <vector83>:
.globl vector83
vector83:
  pushl $0
80107d0d:	6a 00                	push   $0x0
  pushl $83
80107d0f:	6a 53                	push   $0x53
  jmp alltraps
80107d11:	e9 8a f6 ff ff       	jmp    801073a0 <alltraps>

80107d16 <vector84>:
.globl vector84
vector84:
  pushl $0
80107d16:	6a 00                	push   $0x0
  pushl $84
80107d18:	6a 54                	push   $0x54
  jmp alltraps
80107d1a:	e9 81 f6 ff ff       	jmp    801073a0 <alltraps>

80107d1f <vector85>:
.globl vector85
vector85:
  pushl $0
80107d1f:	6a 00                	push   $0x0
  pushl $85
80107d21:	6a 55                	push   $0x55
  jmp alltraps
80107d23:	e9 78 f6 ff ff       	jmp    801073a0 <alltraps>

80107d28 <vector86>:
.globl vector86
vector86:
  pushl $0
80107d28:	6a 00                	push   $0x0
  pushl $86
80107d2a:	6a 56                	push   $0x56
  jmp alltraps
80107d2c:	e9 6f f6 ff ff       	jmp    801073a0 <alltraps>

80107d31 <vector87>:
.globl vector87
vector87:
  pushl $0
80107d31:	6a 00                	push   $0x0
  pushl $87
80107d33:	6a 57                	push   $0x57
  jmp alltraps
80107d35:	e9 66 f6 ff ff       	jmp    801073a0 <alltraps>

80107d3a <vector88>:
.globl vector88
vector88:
  pushl $0
80107d3a:	6a 00                	push   $0x0
  pushl $88
80107d3c:	6a 58                	push   $0x58
  jmp alltraps
80107d3e:	e9 5d f6 ff ff       	jmp    801073a0 <alltraps>

80107d43 <vector89>:
.globl vector89
vector89:
  pushl $0
80107d43:	6a 00                	push   $0x0
  pushl $89
80107d45:	6a 59                	push   $0x59
  jmp alltraps
80107d47:	e9 54 f6 ff ff       	jmp    801073a0 <alltraps>

80107d4c <vector90>:
.globl vector90
vector90:
  pushl $0
80107d4c:	6a 00                	push   $0x0
  pushl $90
80107d4e:	6a 5a                	push   $0x5a
  jmp alltraps
80107d50:	e9 4b f6 ff ff       	jmp    801073a0 <alltraps>

80107d55 <vector91>:
.globl vector91
vector91:
  pushl $0
80107d55:	6a 00                	push   $0x0
  pushl $91
80107d57:	6a 5b                	push   $0x5b
  jmp alltraps
80107d59:	e9 42 f6 ff ff       	jmp    801073a0 <alltraps>

80107d5e <vector92>:
.globl vector92
vector92:
  pushl $0
80107d5e:	6a 00                	push   $0x0
  pushl $92
80107d60:	6a 5c                	push   $0x5c
  jmp alltraps
80107d62:	e9 39 f6 ff ff       	jmp    801073a0 <alltraps>

80107d67 <vector93>:
.globl vector93
vector93:
  pushl $0
80107d67:	6a 00                	push   $0x0
  pushl $93
80107d69:	6a 5d                	push   $0x5d
  jmp alltraps
80107d6b:	e9 30 f6 ff ff       	jmp    801073a0 <alltraps>

80107d70 <vector94>:
.globl vector94
vector94:
  pushl $0
80107d70:	6a 00                	push   $0x0
  pushl $94
80107d72:	6a 5e                	push   $0x5e
  jmp alltraps
80107d74:	e9 27 f6 ff ff       	jmp    801073a0 <alltraps>

80107d79 <vector95>:
.globl vector95
vector95:
  pushl $0
80107d79:	6a 00                	push   $0x0
  pushl $95
80107d7b:	6a 5f                	push   $0x5f
  jmp alltraps
80107d7d:	e9 1e f6 ff ff       	jmp    801073a0 <alltraps>

80107d82 <vector96>:
.globl vector96
vector96:
  pushl $0
80107d82:	6a 00                	push   $0x0
  pushl $96
80107d84:	6a 60                	push   $0x60
  jmp alltraps
80107d86:	e9 15 f6 ff ff       	jmp    801073a0 <alltraps>

80107d8b <vector97>:
.globl vector97
vector97:
  pushl $0
80107d8b:	6a 00                	push   $0x0
  pushl $97
80107d8d:	6a 61                	push   $0x61
  jmp alltraps
80107d8f:	e9 0c f6 ff ff       	jmp    801073a0 <alltraps>

80107d94 <vector98>:
.globl vector98
vector98:
  pushl $0
80107d94:	6a 00                	push   $0x0
  pushl $98
80107d96:	6a 62                	push   $0x62
  jmp alltraps
80107d98:	e9 03 f6 ff ff       	jmp    801073a0 <alltraps>

80107d9d <vector99>:
.globl vector99
vector99:
  pushl $0
80107d9d:	6a 00                	push   $0x0
  pushl $99
80107d9f:	6a 63                	push   $0x63
  jmp alltraps
80107da1:	e9 fa f5 ff ff       	jmp    801073a0 <alltraps>

80107da6 <vector100>:
.globl vector100
vector100:
  pushl $0
80107da6:	6a 00                	push   $0x0
  pushl $100
80107da8:	6a 64                	push   $0x64
  jmp alltraps
80107daa:	e9 f1 f5 ff ff       	jmp    801073a0 <alltraps>

80107daf <vector101>:
.globl vector101
vector101:
  pushl $0
80107daf:	6a 00                	push   $0x0
  pushl $101
80107db1:	6a 65                	push   $0x65
  jmp alltraps
80107db3:	e9 e8 f5 ff ff       	jmp    801073a0 <alltraps>

80107db8 <vector102>:
.globl vector102
vector102:
  pushl $0
80107db8:	6a 00                	push   $0x0
  pushl $102
80107dba:	6a 66                	push   $0x66
  jmp alltraps
80107dbc:	e9 df f5 ff ff       	jmp    801073a0 <alltraps>

80107dc1 <vector103>:
.globl vector103
vector103:
  pushl $0
80107dc1:	6a 00                	push   $0x0
  pushl $103
80107dc3:	6a 67                	push   $0x67
  jmp alltraps
80107dc5:	e9 d6 f5 ff ff       	jmp    801073a0 <alltraps>

80107dca <vector104>:
.globl vector104
vector104:
  pushl $0
80107dca:	6a 00                	push   $0x0
  pushl $104
80107dcc:	6a 68                	push   $0x68
  jmp alltraps
80107dce:	e9 cd f5 ff ff       	jmp    801073a0 <alltraps>

80107dd3 <vector105>:
.globl vector105
vector105:
  pushl $0
80107dd3:	6a 00                	push   $0x0
  pushl $105
80107dd5:	6a 69                	push   $0x69
  jmp alltraps
80107dd7:	e9 c4 f5 ff ff       	jmp    801073a0 <alltraps>

80107ddc <vector106>:
.globl vector106
vector106:
  pushl $0
80107ddc:	6a 00                	push   $0x0
  pushl $106
80107dde:	6a 6a                	push   $0x6a
  jmp alltraps
80107de0:	e9 bb f5 ff ff       	jmp    801073a0 <alltraps>

80107de5 <vector107>:
.globl vector107
vector107:
  pushl $0
80107de5:	6a 00                	push   $0x0
  pushl $107
80107de7:	6a 6b                	push   $0x6b
  jmp alltraps
80107de9:	e9 b2 f5 ff ff       	jmp    801073a0 <alltraps>

80107dee <vector108>:
.globl vector108
vector108:
  pushl $0
80107dee:	6a 00                	push   $0x0
  pushl $108
80107df0:	6a 6c                	push   $0x6c
  jmp alltraps
80107df2:	e9 a9 f5 ff ff       	jmp    801073a0 <alltraps>

80107df7 <vector109>:
.globl vector109
vector109:
  pushl $0
80107df7:	6a 00                	push   $0x0
  pushl $109
80107df9:	6a 6d                	push   $0x6d
  jmp alltraps
80107dfb:	e9 a0 f5 ff ff       	jmp    801073a0 <alltraps>

80107e00 <vector110>:
.globl vector110
vector110:
  pushl $0
80107e00:	6a 00                	push   $0x0
  pushl $110
80107e02:	6a 6e                	push   $0x6e
  jmp alltraps
80107e04:	e9 97 f5 ff ff       	jmp    801073a0 <alltraps>

80107e09 <vector111>:
.globl vector111
vector111:
  pushl $0
80107e09:	6a 00                	push   $0x0
  pushl $111
80107e0b:	6a 6f                	push   $0x6f
  jmp alltraps
80107e0d:	e9 8e f5 ff ff       	jmp    801073a0 <alltraps>

80107e12 <vector112>:
.globl vector112
vector112:
  pushl $0
80107e12:	6a 00                	push   $0x0
  pushl $112
80107e14:	6a 70                	push   $0x70
  jmp alltraps
80107e16:	e9 85 f5 ff ff       	jmp    801073a0 <alltraps>

80107e1b <vector113>:
.globl vector113
vector113:
  pushl $0
80107e1b:	6a 00                	push   $0x0
  pushl $113
80107e1d:	6a 71                	push   $0x71
  jmp alltraps
80107e1f:	e9 7c f5 ff ff       	jmp    801073a0 <alltraps>

80107e24 <vector114>:
.globl vector114
vector114:
  pushl $0
80107e24:	6a 00                	push   $0x0
  pushl $114
80107e26:	6a 72                	push   $0x72
  jmp alltraps
80107e28:	e9 73 f5 ff ff       	jmp    801073a0 <alltraps>

80107e2d <vector115>:
.globl vector115
vector115:
  pushl $0
80107e2d:	6a 00                	push   $0x0
  pushl $115
80107e2f:	6a 73                	push   $0x73
  jmp alltraps
80107e31:	e9 6a f5 ff ff       	jmp    801073a0 <alltraps>

80107e36 <vector116>:
.globl vector116
vector116:
  pushl $0
80107e36:	6a 00                	push   $0x0
  pushl $116
80107e38:	6a 74                	push   $0x74
  jmp alltraps
80107e3a:	e9 61 f5 ff ff       	jmp    801073a0 <alltraps>

80107e3f <vector117>:
.globl vector117
vector117:
  pushl $0
80107e3f:	6a 00                	push   $0x0
  pushl $117
80107e41:	6a 75                	push   $0x75
  jmp alltraps
80107e43:	e9 58 f5 ff ff       	jmp    801073a0 <alltraps>

80107e48 <vector118>:
.globl vector118
vector118:
  pushl $0
80107e48:	6a 00                	push   $0x0
  pushl $118
80107e4a:	6a 76                	push   $0x76
  jmp alltraps
80107e4c:	e9 4f f5 ff ff       	jmp    801073a0 <alltraps>

80107e51 <vector119>:
.globl vector119
vector119:
  pushl $0
80107e51:	6a 00                	push   $0x0
  pushl $119
80107e53:	6a 77                	push   $0x77
  jmp alltraps
80107e55:	e9 46 f5 ff ff       	jmp    801073a0 <alltraps>

80107e5a <vector120>:
.globl vector120
vector120:
  pushl $0
80107e5a:	6a 00                	push   $0x0
  pushl $120
80107e5c:	6a 78                	push   $0x78
  jmp alltraps
80107e5e:	e9 3d f5 ff ff       	jmp    801073a0 <alltraps>

80107e63 <vector121>:
.globl vector121
vector121:
  pushl $0
80107e63:	6a 00                	push   $0x0
  pushl $121
80107e65:	6a 79                	push   $0x79
  jmp alltraps
80107e67:	e9 34 f5 ff ff       	jmp    801073a0 <alltraps>

80107e6c <vector122>:
.globl vector122
vector122:
  pushl $0
80107e6c:	6a 00                	push   $0x0
  pushl $122
80107e6e:	6a 7a                	push   $0x7a
  jmp alltraps
80107e70:	e9 2b f5 ff ff       	jmp    801073a0 <alltraps>

80107e75 <vector123>:
.globl vector123
vector123:
  pushl $0
80107e75:	6a 00                	push   $0x0
  pushl $123
80107e77:	6a 7b                	push   $0x7b
  jmp alltraps
80107e79:	e9 22 f5 ff ff       	jmp    801073a0 <alltraps>

80107e7e <vector124>:
.globl vector124
vector124:
  pushl $0
80107e7e:	6a 00                	push   $0x0
  pushl $124
80107e80:	6a 7c                	push   $0x7c
  jmp alltraps
80107e82:	e9 19 f5 ff ff       	jmp    801073a0 <alltraps>

80107e87 <vector125>:
.globl vector125
vector125:
  pushl $0
80107e87:	6a 00                	push   $0x0
  pushl $125
80107e89:	6a 7d                	push   $0x7d
  jmp alltraps
80107e8b:	e9 10 f5 ff ff       	jmp    801073a0 <alltraps>

80107e90 <vector126>:
.globl vector126
vector126:
  pushl $0
80107e90:	6a 00                	push   $0x0
  pushl $126
80107e92:	6a 7e                	push   $0x7e
  jmp alltraps
80107e94:	e9 07 f5 ff ff       	jmp    801073a0 <alltraps>

80107e99 <vector127>:
.globl vector127
vector127:
  pushl $0
80107e99:	6a 00                	push   $0x0
  pushl $127
80107e9b:	6a 7f                	push   $0x7f
  jmp alltraps
80107e9d:	e9 fe f4 ff ff       	jmp    801073a0 <alltraps>

80107ea2 <vector128>:
.globl vector128
vector128:
  pushl $0
80107ea2:	6a 00                	push   $0x0
  pushl $128
80107ea4:	68 80 00 00 00       	push   $0x80
  jmp alltraps
80107ea9:	e9 f2 f4 ff ff       	jmp    801073a0 <alltraps>

80107eae <vector129>:
.globl vector129
vector129:
  pushl $0
80107eae:	6a 00                	push   $0x0
  pushl $129
80107eb0:	68 81 00 00 00       	push   $0x81
  jmp alltraps
80107eb5:	e9 e6 f4 ff ff       	jmp    801073a0 <alltraps>

80107eba <vector130>:
.globl vector130
vector130:
  pushl $0
80107eba:	6a 00                	push   $0x0
  pushl $130
80107ebc:	68 82 00 00 00       	push   $0x82
  jmp alltraps
80107ec1:	e9 da f4 ff ff       	jmp    801073a0 <alltraps>

80107ec6 <vector131>:
.globl vector131
vector131:
  pushl $0
80107ec6:	6a 00                	push   $0x0
  pushl $131
80107ec8:	68 83 00 00 00       	push   $0x83
  jmp alltraps
80107ecd:	e9 ce f4 ff ff       	jmp    801073a0 <alltraps>

80107ed2 <vector132>:
.globl vector132
vector132:
  pushl $0
80107ed2:	6a 00                	push   $0x0
  pushl $132
80107ed4:	68 84 00 00 00       	push   $0x84
  jmp alltraps
80107ed9:	e9 c2 f4 ff ff       	jmp    801073a0 <alltraps>

80107ede <vector133>:
.globl vector133
vector133:
  pushl $0
80107ede:	6a 00                	push   $0x0
  pushl $133
80107ee0:	68 85 00 00 00       	push   $0x85
  jmp alltraps
80107ee5:	e9 b6 f4 ff ff       	jmp    801073a0 <alltraps>

80107eea <vector134>:
.globl vector134
vector134:
  pushl $0
80107eea:	6a 00                	push   $0x0
  pushl $134
80107eec:	68 86 00 00 00       	push   $0x86
  jmp alltraps
80107ef1:	e9 aa f4 ff ff       	jmp    801073a0 <alltraps>

80107ef6 <vector135>:
.globl vector135
vector135:
  pushl $0
80107ef6:	6a 00                	push   $0x0
  pushl $135
80107ef8:	68 87 00 00 00       	push   $0x87
  jmp alltraps
80107efd:	e9 9e f4 ff ff       	jmp    801073a0 <alltraps>

80107f02 <vector136>:
.globl vector136
vector136:
  pushl $0
80107f02:	6a 00                	push   $0x0
  pushl $136
80107f04:	68 88 00 00 00       	push   $0x88
  jmp alltraps
80107f09:	e9 92 f4 ff ff       	jmp    801073a0 <alltraps>

80107f0e <vector137>:
.globl vector137
vector137:
  pushl $0
80107f0e:	6a 00                	push   $0x0
  pushl $137
80107f10:	68 89 00 00 00       	push   $0x89
  jmp alltraps
80107f15:	e9 86 f4 ff ff       	jmp    801073a0 <alltraps>

80107f1a <vector138>:
.globl vector138
vector138:
  pushl $0
80107f1a:	6a 00                	push   $0x0
  pushl $138
80107f1c:	68 8a 00 00 00       	push   $0x8a
  jmp alltraps
80107f21:	e9 7a f4 ff ff       	jmp    801073a0 <alltraps>

80107f26 <vector139>:
.globl vector139
vector139:
  pushl $0
80107f26:	6a 00                	push   $0x0
  pushl $139
80107f28:	68 8b 00 00 00       	push   $0x8b
  jmp alltraps
80107f2d:	e9 6e f4 ff ff       	jmp    801073a0 <alltraps>

80107f32 <vector140>:
.globl vector140
vector140:
  pushl $0
80107f32:	6a 00                	push   $0x0
  pushl $140
80107f34:	68 8c 00 00 00       	push   $0x8c
  jmp alltraps
80107f39:	e9 62 f4 ff ff       	jmp    801073a0 <alltraps>

80107f3e <vector141>:
.globl vector141
vector141:
  pushl $0
80107f3e:	6a 00                	push   $0x0
  pushl $141
80107f40:	68 8d 00 00 00       	push   $0x8d
  jmp alltraps
80107f45:	e9 56 f4 ff ff       	jmp    801073a0 <alltraps>

80107f4a <vector142>:
.globl vector142
vector142:
  pushl $0
80107f4a:	6a 00                	push   $0x0
  pushl $142
80107f4c:	68 8e 00 00 00       	push   $0x8e
  jmp alltraps
80107f51:	e9 4a f4 ff ff       	jmp    801073a0 <alltraps>

80107f56 <vector143>:
.globl vector143
vector143:
  pushl $0
80107f56:	6a 00                	push   $0x0
  pushl $143
80107f58:	68 8f 00 00 00       	push   $0x8f
  jmp alltraps
80107f5d:	e9 3e f4 ff ff       	jmp    801073a0 <alltraps>

80107f62 <vector144>:
.globl vector144
vector144:
  pushl $0
80107f62:	6a 00                	push   $0x0
  pushl $144
80107f64:	68 90 00 00 00       	push   $0x90
  jmp alltraps
80107f69:	e9 32 f4 ff ff       	jmp    801073a0 <alltraps>

80107f6e <vector145>:
.globl vector145
vector145:
  pushl $0
80107f6e:	6a 00                	push   $0x0
  pushl $145
80107f70:	68 91 00 00 00       	push   $0x91
  jmp alltraps
80107f75:	e9 26 f4 ff ff       	jmp    801073a0 <alltraps>

80107f7a <vector146>:
.globl vector146
vector146:
  pushl $0
80107f7a:	6a 00                	push   $0x0
  pushl $146
80107f7c:	68 92 00 00 00       	push   $0x92
  jmp alltraps
80107f81:	e9 1a f4 ff ff       	jmp    801073a0 <alltraps>

80107f86 <vector147>:
.globl vector147
vector147:
  pushl $0
80107f86:	6a 00                	push   $0x0
  pushl $147
80107f88:	68 93 00 00 00       	push   $0x93
  jmp alltraps
80107f8d:	e9 0e f4 ff ff       	jmp    801073a0 <alltraps>

80107f92 <vector148>:
.globl vector148
vector148:
  pushl $0
80107f92:	6a 00                	push   $0x0
  pushl $148
80107f94:	68 94 00 00 00       	push   $0x94
  jmp alltraps
80107f99:	e9 02 f4 ff ff       	jmp    801073a0 <alltraps>

80107f9e <vector149>:
.globl vector149
vector149:
  pushl $0
80107f9e:	6a 00                	push   $0x0
  pushl $149
80107fa0:	68 95 00 00 00       	push   $0x95
  jmp alltraps
80107fa5:	e9 f6 f3 ff ff       	jmp    801073a0 <alltraps>

80107faa <vector150>:
.globl vector150
vector150:
  pushl $0
80107faa:	6a 00                	push   $0x0
  pushl $150
80107fac:	68 96 00 00 00       	push   $0x96
  jmp alltraps
80107fb1:	e9 ea f3 ff ff       	jmp    801073a0 <alltraps>

80107fb6 <vector151>:
.globl vector151
vector151:
  pushl $0
80107fb6:	6a 00                	push   $0x0
  pushl $151
80107fb8:	68 97 00 00 00       	push   $0x97
  jmp alltraps
80107fbd:	e9 de f3 ff ff       	jmp    801073a0 <alltraps>

80107fc2 <vector152>:
.globl vector152
vector152:
  pushl $0
80107fc2:	6a 00                	push   $0x0
  pushl $152
80107fc4:	68 98 00 00 00       	push   $0x98
  jmp alltraps
80107fc9:	e9 d2 f3 ff ff       	jmp    801073a0 <alltraps>

80107fce <vector153>:
.globl vector153
vector153:
  pushl $0
80107fce:	6a 00                	push   $0x0
  pushl $153
80107fd0:	68 99 00 00 00       	push   $0x99
  jmp alltraps
80107fd5:	e9 c6 f3 ff ff       	jmp    801073a0 <alltraps>

80107fda <vector154>:
.globl vector154
vector154:
  pushl $0
80107fda:	6a 00                	push   $0x0
  pushl $154
80107fdc:	68 9a 00 00 00       	push   $0x9a
  jmp alltraps
80107fe1:	e9 ba f3 ff ff       	jmp    801073a0 <alltraps>

80107fe6 <vector155>:
.globl vector155
vector155:
  pushl $0
80107fe6:	6a 00                	push   $0x0
  pushl $155
80107fe8:	68 9b 00 00 00       	push   $0x9b
  jmp alltraps
80107fed:	e9 ae f3 ff ff       	jmp    801073a0 <alltraps>

80107ff2 <vector156>:
.globl vector156
vector156:
  pushl $0
80107ff2:	6a 00                	push   $0x0
  pushl $156
80107ff4:	68 9c 00 00 00       	push   $0x9c
  jmp alltraps
80107ff9:	e9 a2 f3 ff ff       	jmp    801073a0 <alltraps>

80107ffe <vector157>:
.globl vector157
vector157:
  pushl $0
80107ffe:	6a 00                	push   $0x0
  pushl $157
80108000:	68 9d 00 00 00       	push   $0x9d
  jmp alltraps
80108005:	e9 96 f3 ff ff       	jmp    801073a0 <alltraps>

8010800a <vector158>:
.globl vector158
vector158:
  pushl $0
8010800a:	6a 00                	push   $0x0
  pushl $158
8010800c:	68 9e 00 00 00       	push   $0x9e
  jmp alltraps
80108011:	e9 8a f3 ff ff       	jmp    801073a0 <alltraps>

80108016 <vector159>:
.globl vector159
vector159:
  pushl $0
80108016:	6a 00                	push   $0x0
  pushl $159
80108018:	68 9f 00 00 00       	push   $0x9f
  jmp alltraps
8010801d:	e9 7e f3 ff ff       	jmp    801073a0 <alltraps>

80108022 <vector160>:
.globl vector160
vector160:
  pushl $0
80108022:	6a 00                	push   $0x0
  pushl $160
80108024:	68 a0 00 00 00       	push   $0xa0
  jmp alltraps
80108029:	e9 72 f3 ff ff       	jmp    801073a0 <alltraps>

8010802e <vector161>:
.globl vector161
vector161:
  pushl $0
8010802e:	6a 00                	push   $0x0
  pushl $161
80108030:	68 a1 00 00 00       	push   $0xa1
  jmp alltraps
80108035:	e9 66 f3 ff ff       	jmp    801073a0 <alltraps>

8010803a <vector162>:
.globl vector162
vector162:
  pushl $0
8010803a:	6a 00                	push   $0x0
  pushl $162
8010803c:	68 a2 00 00 00       	push   $0xa2
  jmp alltraps
80108041:	e9 5a f3 ff ff       	jmp    801073a0 <alltraps>

80108046 <vector163>:
.globl vector163
vector163:
  pushl $0
80108046:	6a 00                	push   $0x0
  pushl $163
80108048:	68 a3 00 00 00       	push   $0xa3
  jmp alltraps
8010804d:	e9 4e f3 ff ff       	jmp    801073a0 <alltraps>

80108052 <vector164>:
.globl vector164
vector164:
  pushl $0
80108052:	6a 00                	push   $0x0
  pushl $164
80108054:	68 a4 00 00 00       	push   $0xa4
  jmp alltraps
80108059:	e9 42 f3 ff ff       	jmp    801073a0 <alltraps>

8010805e <vector165>:
.globl vector165
vector165:
  pushl $0
8010805e:	6a 00                	push   $0x0
  pushl $165
80108060:	68 a5 00 00 00       	push   $0xa5
  jmp alltraps
80108065:	e9 36 f3 ff ff       	jmp    801073a0 <alltraps>

8010806a <vector166>:
.globl vector166
vector166:
  pushl $0
8010806a:	6a 00                	push   $0x0
  pushl $166
8010806c:	68 a6 00 00 00       	push   $0xa6
  jmp alltraps
80108071:	e9 2a f3 ff ff       	jmp    801073a0 <alltraps>

80108076 <vector167>:
.globl vector167
vector167:
  pushl $0
80108076:	6a 00                	push   $0x0
  pushl $167
80108078:	68 a7 00 00 00       	push   $0xa7
  jmp alltraps
8010807d:	e9 1e f3 ff ff       	jmp    801073a0 <alltraps>

80108082 <vector168>:
.globl vector168
vector168:
  pushl $0
80108082:	6a 00                	push   $0x0
  pushl $168
80108084:	68 a8 00 00 00       	push   $0xa8
  jmp alltraps
80108089:	e9 12 f3 ff ff       	jmp    801073a0 <alltraps>

8010808e <vector169>:
.globl vector169
vector169:
  pushl $0
8010808e:	6a 00                	push   $0x0
  pushl $169
80108090:	68 a9 00 00 00       	push   $0xa9
  jmp alltraps
80108095:	e9 06 f3 ff ff       	jmp    801073a0 <alltraps>

8010809a <vector170>:
.globl vector170
vector170:
  pushl $0
8010809a:	6a 00                	push   $0x0
  pushl $170
8010809c:	68 aa 00 00 00       	push   $0xaa
  jmp alltraps
801080a1:	e9 fa f2 ff ff       	jmp    801073a0 <alltraps>

801080a6 <vector171>:
.globl vector171
vector171:
  pushl $0
801080a6:	6a 00                	push   $0x0
  pushl $171
801080a8:	68 ab 00 00 00       	push   $0xab
  jmp alltraps
801080ad:	e9 ee f2 ff ff       	jmp    801073a0 <alltraps>

801080b2 <vector172>:
.globl vector172
vector172:
  pushl $0
801080b2:	6a 00                	push   $0x0
  pushl $172
801080b4:	68 ac 00 00 00       	push   $0xac
  jmp alltraps
801080b9:	e9 e2 f2 ff ff       	jmp    801073a0 <alltraps>

801080be <vector173>:
.globl vector173
vector173:
  pushl $0
801080be:	6a 00                	push   $0x0
  pushl $173
801080c0:	68 ad 00 00 00       	push   $0xad
  jmp alltraps
801080c5:	e9 d6 f2 ff ff       	jmp    801073a0 <alltraps>

801080ca <vector174>:
.globl vector174
vector174:
  pushl $0
801080ca:	6a 00                	push   $0x0
  pushl $174
801080cc:	68 ae 00 00 00       	push   $0xae
  jmp alltraps
801080d1:	e9 ca f2 ff ff       	jmp    801073a0 <alltraps>

801080d6 <vector175>:
.globl vector175
vector175:
  pushl $0
801080d6:	6a 00                	push   $0x0
  pushl $175
801080d8:	68 af 00 00 00       	push   $0xaf
  jmp alltraps
801080dd:	e9 be f2 ff ff       	jmp    801073a0 <alltraps>

801080e2 <vector176>:
.globl vector176
vector176:
  pushl $0
801080e2:	6a 00                	push   $0x0
  pushl $176
801080e4:	68 b0 00 00 00       	push   $0xb0
  jmp alltraps
801080e9:	e9 b2 f2 ff ff       	jmp    801073a0 <alltraps>

801080ee <vector177>:
.globl vector177
vector177:
  pushl $0
801080ee:	6a 00                	push   $0x0
  pushl $177
801080f0:	68 b1 00 00 00       	push   $0xb1
  jmp alltraps
801080f5:	e9 a6 f2 ff ff       	jmp    801073a0 <alltraps>

801080fa <vector178>:
.globl vector178
vector178:
  pushl $0
801080fa:	6a 00                	push   $0x0
  pushl $178
801080fc:	68 b2 00 00 00       	push   $0xb2
  jmp alltraps
80108101:	e9 9a f2 ff ff       	jmp    801073a0 <alltraps>

80108106 <vector179>:
.globl vector179
vector179:
  pushl $0
80108106:	6a 00                	push   $0x0
  pushl $179
80108108:	68 b3 00 00 00       	push   $0xb3
  jmp alltraps
8010810d:	e9 8e f2 ff ff       	jmp    801073a0 <alltraps>

80108112 <vector180>:
.globl vector180
vector180:
  pushl $0
80108112:	6a 00                	push   $0x0
  pushl $180
80108114:	68 b4 00 00 00       	push   $0xb4
  jmp alltraps
80108119:	e9 82 f2 ff ff       	jmp    801073a0 <alltraps>

8010811e <vector181>:
.globl vector181
vector181:
  pushl $0
8010811e:	6a 00                	push   $0x0
  pushl $181
80108120:	68 b5 00 00 00       	push   $0xb5
  jmp alltraps
80108125:	e9 76 f2 ff ff       	jmp    801073a0 <alltraps>

8010812a <vector182>:
.globl vector182
vector182:
  pushl $0
8010812a:	6a 00                	push   $0x0
  pushl $182
8010812c:	68 b6 00 00 00       	push   $0xb6
  jmp alltraps
80108131:	e9 6a f2 ff ff       	jmp    801073a0 <alltraps>

80108136 <vector183>:
.globl vector183
vector183:
  pushl $0
80108136:	6a 00                	push   $0x0
  pushl $183
80108138:	68 b7 00 00 00       	push   $0xb7
  jmp alltraps
8010813d:	e9 5e f2 ff ff       	jmp    801073a0 <alltraps>

80108142 <vector184>:
.globl vector184
vector184:
  pushl $0
80108142:	6a 00                	push   $0x0
  pushl $184
80108144:	68 b8 00 00 00       	push   $0xb8
  jmp alltraps
80108149:	e9 52 f2 ff ff       	jmp    801073a0 <alltraps>

8010814e <vector185>:
.globl vector185
vector185:
  pushl $0
8010814e:	6a 00                	push   $0x0
  pushl $185
80108150:	68 b9 00 00 00       	push   $0xb9
  jmp alltraps
80108155:	e9 46 f2 ff ff       	jmp    801073a0 <alltraps>

8010815a <vector186>:
.globl vector186
vector186:
  pushl $0
8010815a:	6a 00                	push   $0x0
  pushl $186
8010815c:	68 ba 00 00 00       	push   $0xba
  jmp alltraps
80108161:	e9 3a f2 ff ff       	jmp    801073a0 <alltraps>

80108166 <vector187>:
.globl vector187
vector187:
  pushl $0
80108166:	6a 00                	push   $0x0
  pushl $187
80108168:	68 bb 00 00 00       	push   $0xbb
  jmp alltraps
8010816d:	e9 2e f2 ff ff       	jmp    801073a0 <alltraps>

80108172 <vector188>:
.globl vector188
vector188:
  pushl $0
80108172:	6a 00                	push   $0x0
  pushl $188
80108174:	68 bc 00 00 00       	push   $0xbc
  jmp alltraps
80108179:	e9 22 f2 ff ff       	jmp    801073a0 <alltraps>

8010817e <vector189>:
.globl vector189
vector189:
  pushl $0
8010817e:	6a 00                	push   $0x0
  pushl $189
80108180:	68 bd 00 00 00       	push   $0xbd
  jmp alltraps
80108185:	e9 16 f2 ff ff       	jmp    801073a0 <alltraps>

8010818a <vector190>:
.globl vector190
vector190:
  pushl $0
8010818a:	6a 00                	push   $0x0
  pushl $190
8010818c:	68 be 00 00 00       	push   $0xbe
  jmp alltraps
80108191:	e9 0a f2 ff ff       	jmp    801073a0 <alltraps>

80108196 <vector191>:
.globl vector191
vector191:
  pushl $0
80108196:	6a 00                	push   $0x0
  pushl $191
80108198:	68 bf 00 00 00       	push   $0xbf
  jmp alltraps
8010819d:	e9 fe f1 ff ff       	jmp    801073a0 <alltraps>

801081a2 <vector192>:
.globl vector192
vector192:
  pushl $0
801081a2:	6a 00                	push   $0x0
  pushl $192
801081a4:	68 c0 00 00 00       	push   $0xc0
  jmp alltraps
801081a9:	e9 f2 f1 ff ff       	jmp    801073a0 <alltraps>

801081ae <vector193>:
.globl vector193
vector193:
  pushl $0
801081ae:	6a 00                	push   $0x0
  pushl $193
801081b0:	68 c1 00 00 00       	push   $0xc1
  jmp alltraps
801081b5:	e9 e6 f1 ff ff       	jmp    801073a0 <alltraps>

801081ba <vector194>:
.globl vector194
vector194:
  pushl $0
801081ba:	6a 00                	push   $0x0
  pushl $194
801081bc:	68 c2 00 00 00       	push   $0xc2
  jmp alltraps
801081c1:	e9 da f1 ff ff       	jmp    801073a0 <alltraps>

801081c6 <vector195>:
.globl vector195
vector195:
  pushl $0
801081c6:	6a 00                	push   $0x0
  pushl $195
801081c8:	68 c3 00 00 00       	push   $0xc3
  jmp alltraps
801081cd:	e9 ce f1 ff ff       	jmp    801073a0 <alltraps>

801081d2 <vector196>:
.globl vector196
vector196:
  pushl $0
801081d2:	6a 00                	push   $0x0
  pushl $196
801081d4:	68 c4 00 00 00       	push   $0xc4
  jmp alltraps
801081d9:	e9 c2 f1 ff ff       	jmp    801073a0 <alltraps>

801081de <vector197>:
.globl vector197
vector197:
  pushl $0
801081de:	6a 00                	push   $0x0
  pushl $197
801081e0:	68 c5 00 00 00       	push   $0xc5
  jmp alltraps
801081e5:	e9 b6 f1 ff ff       	jmp    801073a0 <alltraps>

801081ea <vector198>:
.globl vector198
vector198:
  pushl $0
801081ea:	6a 00                	push   $0x0
  pushl $198
801081ec:	68 c6 00 00 00       	push   $0xc6
  jmp alltraps
801081f1:	e9 aa f1 ff ff       	jmp    801073a0 <alltraps>

801081f6 <vector199>:
.globl vector199
vector199:
  pushl $0
801081f6:	6a 00                	push   $0x0
  pushl $199
801081f8:	68 c7 00 00 00       	push   $0xc7
  jmp alltraps
801081fd:	e9 9e f1 ff ff       	jmp    801073a0 <alltraps>

80108202 <vector200>:
.globl vector200
vector200:
  pushl $0
80108202:	6a 00                	push   $0x0
  pushl $200
80108204:	68 c8 00 00 00       	push   $0xc8
  jmp alltraps
80108209:	e9 92 f1 ff ff       	jmp    801073a0 <alltraps>

8010820e <vector201>:
.globl vector201
vector201:
  pushl $0
8010820e:	6a 00                	push   $0x0
  pushl $201
80108210:	68 c9 00 00 00       	push   $0xc9
  jmp alltraps
80108215:	e9 86 f1 ff ff       	jmp    801073a0 <alltraps>

8010821a <vector202>:
.globl vector202
vector202:
  pushl $0
8010821a:	6a 00                	push   $0x0
  pushl $202
8010821c:	68 ca 00 00 00       	push   $0xca
  jmp alltraps
80108221:	e9 7a f1 ff ff       	jmp    801073a0 <alltraps>

80108226 <vector203>:
.globl vector203
vector203:
  pushl $0
80108226:	6a 00                	push   $0x0
  pushl $203
80108228:	68 cb 00 00 00       	push   $0xcb
  jmp alltraps
8010822d:	e9 6e f1 ff ff       	jmp    801073a0 <alltraps>

80108232 <vector204>:
.globl vector204
vector204:
  pushl $0
80108232:	6a 00                	push   $0x0
  pushl $204
80108234:	68 cc 00 00 00       	push   $0xcc
  jmp alltraps
80108239:	e9 62 f1 ff ff       	jmp    801073a0 <alltraps>

8010823e <vector205>:
.globl vector205
vector205:
  pushl $0
8010823e:	6a 00                	push   $0x0
  pushl $205
80108240:	68 cd 00 00 00       	push   $0xcd
  jmp alltraps
80108245:	e9 56 f1 ff ff       	jmp    801073a0 <alltraps>

8010824a <vector206>:
.globl vector206
vector206:
  pushl $0
8010824a:	6a 00                	push   $0x0
  pushl $206
8010824c:	68 ce 00 00 00       	push   $0xce
  jmp alltraps
80108251:	e9 4a f1 ff ff       	jmp    801073a0 <alltraps>

80108256 <vector207>:
.globl vector207
vector207:
  pushl $0
80108256:	6a 00                	push   $0x0
  pushl $207
80108258:	68 cf 00 00 00       	push   $0xcf
  jmp alltraps
8010825d:	e9 3e f1 ff ff       	jmp    801073a0 <alltraps>

80108262 <vector208>:
.globl vector208
vector208:
  pushl $0
80108262:	6a 00                	push   $0x0
  pushl $208
80108264:	68 d0 00 00 00       	push   $0xd0
  jmp alltraps
80108269:	e9 32 f1 ff ff       	jmp    801073a0 <alltraps>

8010826e <vector209>:
.globl vector209
vector209:
  pushl $0
8010826e:	6a 00                	push   $0x0
  pushl $209
80108270:	68 d1 00 00 00       	push   $0xd1
  jmp alltraps
80108275:	e9 26 f1 ff ff       	jmp    801073a0 <alltraps>

8010827a <vector210>:
.globl vector210
vector210:
  pushl $0
8010827a:	6a 00                	push   $0x0
  pushl $210
8010827c:	68 d2 00 00 00       	push   $0xd2
  jmp alltraps
80108281:	e9 1a f1 ff ff       	jmp    801073a0 <alltraps>

80108286 <vector211>:
.globl vector211
vector211:
  pushl $0
80108286:	6a 00                	push   $0x0
  pushl $211
80108288:	68 d3 00 00 00       	push   $0xd3
  jmp alltraps
8010828d:	e9 0e f1 ff ff       	jmp    801073a0 <alltraps>

80108292 <vector212>:
.globl vector212
vector212:
  pushl $0
80108292:	6a 00                	push   $0x0
  pushl $212
80108294:	68 d4 00 00 00       	push   $0xd4
  jmp alltraps
80108299:	e9 02 f1 ff ff       	jmp    801073a0 <alltraps>

8010829e <vector213>:
.globl vector213
vector213:
  pushl $0
8010829e:	6a 00                	push   $0x0
  pushl $213
801082a0:	68 d5 00 00 00       	push   $0xd5
  jmp alltraps
801082a5:	e9 f6 f0 ff ff       	jmp    801073a0 <alltraps>

801082aa <vector214>:
.globl vector214
vector214:
  pushl $0
801082aa:	6a 00                	push   $0x0
  pushl $214
801082ac:	68 d6 00 00 00       	push   $0xd6
  jmp alltraps
801082b1:	e9 ea f0 ff ff       	jmp    801073a0 <alltraps>

801082b6 <vector215>:
.globl vector215
vector215:
  pushl $0
801082b6:	6a 00                	push   $0x0
  pushl $215
801082b8:	68 d7 00 00 00       	push   $0xd7
  jmp alltraps
801082bd:	e9 de f0 ff ff       	jmp    801073a0 <alltraps>

801082c2 <vector216>:
.globl vector216
vector216:
  pushl $0
801082c2:	6a 00                	push   $0x0
  pushl $216
801082c4:	68 d8 00 00 00       	push   $0xd8
  jmp alltraps
801082c9:	e9 d2 f0 ff ff       	jmp    801073a0 <alltraps>

801082ce <vector217>:
.globl vector217
vector217:
  pushl $0
801082ce:	6a 00                	push   $0x0
  pushl $217
801082d0:	68 d9 00 00 00       	push   $0xd9
  jmp alltraps
801082d5:	e9 c6 f0 ff ff       	jmp    801073a0 <alltraps>

801082da <vector218>:
.globl vector218
vector218:
  pushl $0
801082da:	6a 00                	push   $0x0
  pushl $218
801082dc:	68 da 00 00 00       	push   $0xda
  jmp alltraps
801082e1:	e9 ba f0 ff ff       	jmp    801073a0 <alltraps>

801082e6 <vector219>:
.globl vector219
vector219:
  pushl $0
801082e6:	6a 00                	push   $0x0
  pushl $219
801082e8:	68 db 00 00 00       	push   $0xdb
  jmp alltraps
801082ed:	e9 ae f0 ff ff       	jmp    801073a0 <alltraps>

801082f2 <vector220>:
.globl vector220
vector220:
  pushl $0
801082f2:	6a 00                	push   $0x0
  pushl $220
801082f4:	68 dc 00 00 00       	push   $0xdc
  jmp alltraps
801082f9:	e9 a2 f0 ff ff       	jmp    801073a0 <alltraps>

801082fe <vector221>:
.globl vector221
vector221:
  pushl $0
801082fe:	6a 00                	push   $0x0
  pushl $221
80108300:	68 dd 00 00 00       	push   $0xdd
  jmp alltraps
80108305:	e9 96 f0 ff ff       	jmp    801073a0 <alltraps>

8010830a <vector222>:
.globl vector222
vector222:
  pushl $0
8010830a:	6a 00                	push   $0x0
  pushl $222
8010830c:	68 de 00 00 00       	push   $0xde
  jmp alltraps
80108311:	e9 8a f0 ff ff       	jmp    801073a0 <alltraps>

80108316 <vector223>:
.globl vector223
vector223:
  pushl $0
80108316:	6a 00                	push   $0x0
  pushl $223
80108318:	68 df 00 00 00       	push   $0xdf
  jmp alltraps
8010831d:	e9 7e f0 ff ff       	jmp    801073a0 <alltraps>

80108322 <vector224>:
.globl vector224
vector224:
  pushl $0
80108322:	6a 00                	push   $0x0
  pushl $224
80108324:	68 e0 00 00 00       	push   $0xe0
  jmp alltraps
80108329:	e9 72 f0 ff ff       	jmp    801073a0 <alltraps>

8010832e <vector225>:
.globl vector225
vector225:
  pushl $0
8010832e:	6a 00                	push   $0x0
  pushl $225
80108330:	68 e1 00 00 00       	push   $0xe1
  jmp alltraps
80108335:	e9 66 f0 ff ff       	jmp    801073a0 <alltraps>

8010833a <vector226>:
.globl vector226
vector226:
  pushl $0
8010833a:	6a 00                	push   $0x0
  pushl $226
8010833c:	68 e2 00 00 00       	push   $0xe2
  jmp alltraps
80108341:	e9 5a f0 ff ff       	jmp    801073a0 <alltraps>

80108346 <vector227>:
.globl vector227
vector227:
  pushl $0
80108346:	6a 00                	push   $0x0
  pushl $227
80108348:	68 e3 00 00 00       	push   $0xe3
  jmp alltraps
8010834d:	e9 4e f0 ff ff       	jmp    801073a0 <alltraps>

80108352 <vector228>:
.globl vector228
vector228:
  pushl $0
80108352:	6a 00                	push   $0x0
  pushl $228
80108354:	68 e4 00 00 00       	push   $0xe4
  jmp alltraps
80108359:	e9 42 f0 ff ff       	jmp    801073a0 <alltraps>

8010835e <vector229>:
.globl vector229
vector229:
  pushl $0
8010835e:	6a 00                	push   $0x0
  pushl $229
80108360:	68 e5 00 00 00       	push   $0xe5
  jmp alltraps
80108365:	e9 36 f0 ff ff       	jmp    801073a0 <alltraps>

8010836a <vector230>:
.globl vector230
vector230:
  pushl $0
8010836a:	6a 00                	push   $0x0
  pushl $230
8010836c:	68 e6 00 00 00       	push   $0xe6
  jmp alltraps
80108371:	e9 2a f0 ff ff       	jmp    801073a0 <alltraps>

80108376 <vector231>:
.globl vector231
vector231:
  pushl $0
80108376:	6a 00                	push   $0x0
  pushl $231
80108378:	68 e7 00 00 00       	push   $0xe7
  jmp alltraps
8010837d:	e9 1e f0 ff ff       	jmp    801073a0 <alltraps>

80108382 <vector232>:
.globl vector232
vector232:
  pushl $0
80108382:	6a 00                	push   $0x0
  pushl $232
80108384:	68 e8 00 00 00       	push   $0xe8
  jmp alltraps
80108389:	e9 12 f0 ff ff       	jmp    801073a0 <alltraps>

8010838e <vector233>:
.globl vector233
vector233:
  pushl $0
8010838e:	6a 00                	push   $0x0
  pushl $233
80108390:	68 e9 00 00 00       	push   $0xe9
  jmp alltraps
80108395:	e9 06 f0 ff ff       	jmp    801073a0 <alltraps>

8010839a <vector234>:
.globl vector234
vector234:
  pushl $0
8010839a:	6a 00                	push   $0x0
  pushl $234
8010839c:	68 ea 00 00 00       	push   $0xea
  jmp alltraps
801083a1:	e9 fa ef ff ff       	jmp    801073a0 <alltraps>

801083a6 <vector235>:
.globl vector235
vector235:
  pushl $0
801083a6:	6a 00                	push   $0x0
  pushl $235
801083a8:	68 eb 00 00 00       	push   $0xeb
  jmp alltraps
801083ad:	e9 ee ef ff ff       	jmp    801073a0 <alltraps>

801083b2 <vector236>:
.globl vector236
vector236:
  pushl $0
801083b2:	6a 00                	push   $0x0
  pushl $236
801083b4:	68 ec 00 00 00       	push   $0xec
  jmp alltraps
801083b9:	e9 e2 ef ff ff       	jmp    801073a0 <alltraps>

801083be <vector237>:
.globl vector237
vector237:
  pushl $0
801083be:	6a 00                	push   $0x0
  pushl $237
801083c0:	68 ed 00 00 00       	push   $0xed
  jmp alltraps
801083c5:	e9 d6 ef ff ff       	jmp    801073a0 <alltraps>

801083ca <vector238>:
.globl vector238
vector238:
  pushl $0
801083ca:	6a 00                	push   $0x0
  pushl $238
801083cc:	68 ee 00 00 00       	push   $0xee
  jmp alltraps
801083d1:	e9 ca ef ff ff       	jmp    801073a0 <alltraps>

801083d6 <vector239>:
.globl vector239
vector239:
  pushl $0
801083d6:	6a 00                	push   $0x0
  pushl $239
801083d8:	68 ef 00 00 00       	push   $0xef
  jmp alltraps
801083dd:	e9 be ef ff ff       	jmp    801073a0 <alltraps>

801083e2 <vector240>:
.globl vector240
vector240:
  pushl $0
801083e2:	6a 00                	push   $0x0
  pushl $240
801083e4:	68 f0 00 00 00       	push   $0xf0
  jmp alltraps
801083e9:	e9 b2 ef ff ff       	jmp    801073a0 <alltraps>

801083ee <vector241>:
.globl vector241
vector241:
  pushl $0
801083ee:	6a 00                	push   $0x0
  pushl $241
801083f0:	68 f1 00 00 00       	push   $0xf1
  jmp alltraps
801083f5:	e9 a6 ef ff ff       	jmp    801073a0 <alltraps>

801083fa <vector242>:
.globl vector242
vector242:
  pushl $0
801083fa:	6a 00                	push   $0x0
  pushl $242
801083fc:	68 f2 00 00 00       	push   $0xf2
  jmp alltraps
80108401:	e9 9a ef ff ff       	jmp    801073a0 <alltraps>

80108406 <vector243>:
.globl vector243
vector243:
  pushl $0
80108406:	6a 00                	push   $0x0
  pushl $243
80108408:	68 f3 00 00 00       	push   $0xf3
  jmp alltraps
8010840d:	e9 8e ef ff ff       	jmp    801073a0 <alltraps>

80108412 <vector244>:
.globl vector244
vector244:
  pushl $0
80108412:	6a 00                	push   $0x0
  pushl $244
80108414:	68 f4 00 00 00       	push   $0xf4
  jmp alltraps
80108419:	e9 82 ef ff ff       	jmp    801073a0 <alltraps>

8010841e <vector245>:
.globl vector245
vector245:
  pushl $0
8010841e:	6a 00                	push   $0x0
  pushl $245
80108420:	68 f5 00 00 00       	push   $0xf5
  jmp alltraps
80108425:	e9 76 ef ff ff       	jmp    801073a0 <alltraps>

8010842a <vector246>:
.globl vector246
vector246:
  pushl $0
8010842a:	6a 00                	push   $0x0
  pushl $246
8010842c:	68 f6 00 00 00       	push   $0xf6
  jmp alltraps
80108431:	e9 6a ef ff ff       	jmp    801073a0 <alltraps>

80108436 <vector247>:
.globl vector247
vector247:
  pushl $0
80108436:	6a 00                	push   $0x0
  pushl $247
80108438:	68 f7 00 00 00       	push   $0xf7
  jmp alltraps
8010843d:	e9 5e ef ff ff       	jmp    801073a0 <alltraps>

80108442 <vector248>:
.globl vector248
vector248:
  pushl $0
80108442:	6a 00                	push   $0x0
  pushl $248
80108444:	68 f8 00 00 00       	push   $0xf8
  jmp alltraps
80108449:	e9 52 ef ff ff       	jmp    801073a0 <alltraps>

8010844e <vector249>:
.globl vector249
vector249:
  pushl $0
8010844e:	6a 00                	push   $0x0
  pushl $249
80108450:	68 f9 00 00 00       	push   $0xf9
  jmp alltraps
80108455:	e9 46 ef ff ff       	jmp    801073a0 <alltraps>

8010845a <vector250>:
.globl vector250
vector250:
  pushl $0
8010845a:	6a 00                	push   $0x0
  pushl $250
8010845c:	68 fa 00 00 00       	push   $0xfa
  jmp alltraps
80108461:	e9 3a ef ff ff       	jmp    801073a0 <alltraps>

80108466 <vector251>:
.globl vector251
vector251:
  pushl $0
80108466:	6a 00                	push   $0x0
  pushl $251
80108468:	68 fb 00 00 00       	push   $0xfb
  jmp alltraps
8010846d:	e9 2e ef ff ff       	jmp    801073a0 <alltraps>

80108472 <vector252>:
.globl vector252
vector252:
  pushl $0
80108472:	6a 00                	push   $0x0
  pushl $252
80108474:	68 fc 00 00 00       	push   $0xfc
  jmp alltraps
80108479:	e9 22 ef ff ff       	jmp    801073a0 <alltraps>

8010847e <vector253>:
.globl vector253
vector253:
  pushl $0
8010847e:	6a 00                	push   $0x0
  pushl $253
80108480:	68 fd 00 00 00       	push   $0xfd
  jmp alltraps
80108485:	e9 16 ef ff ff       	jmp    801073a0 <alltraps>

8010848a <vector254>:
.globl vector254
vector254:
  pushl $0
8010848a:	6a 00                	push   $0x0
  pushl $254
8010848c:	68 fe 00 00 00       	push   $0xfe
  jmp alltraps
80108491:	e9 0a ef ff ff       	jmp    801073a0 <alltraps>

80108496 <vector255>:
.globl vector255
vector255:
  pushl $0
80108496:	6a 00                	push   $0x0
  pushl $255
80108498:	68 ff 00 00 00       	push   $0xff
  jmp alltraps
8010849d:	e9 fe ee ff ff       	jmp    801073a0 <alltraps>
801084a2:	66 90                	xchg   %ax,%ax

801084a4 <lgdt>:

struct segdesc;

static inline void
lgdt(struct segdesc *p, int size)
{
801084a4:	55                   	push   %ebp
801084a5:	89 e5                	mov    %esp,%ebp
801084a7:	83 ec 10             	sub    $0x10,%esp
  volatile ushort pd[3];

  pd[0] = size-1;
801084aa:	8b 45 0c             	mov    0xc(%ebp),%eax
801084ad:	83 e8 01             	sub    $0x1,%eax
801084b0:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
  pd[1] = (uint)p;
801084b4:	8b 45 08             	mov    0x8(%ebp),%eax
801084b7:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  pd[2] = (uint)p >> 16;
801084bb:	8b 45 08             	mov    0x8(%ebp),%eax
801084be:	c1 e8 10             	shr    $0x10,%eax
801084c1:	66 89 45 fe          	mov    %ax,-0x2(%ebp)

  asm volatile("lgdt (%0)" : : "r" (pd));
801084c5:	8d 45 fa             	lea    -0x6(%ebp),%eax
801084c8:	0f 01 10             	lgdtl  (%eax)
}
801084cb:	c9                   	leave  
801084cc:	c3                   	ret    

801084cd <ltr>:
  asm volatile("lidt (%0)" : : "r" (pd));
}

static inline void
ltr(ushort sel)
{
801084cd:	55                   	push   %ebp
801084ce:	89 e5                	mov    %esp,%ebp
801084d0:	83 ec 04             	sub    $0x4,%esp
801084d3:	8b 45 08             	mov    0x8(%ebp),%eax
801084d6:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  asm volatile("ltr %0" : : "r" (sel));
801084da:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
801084de:	0f 00 d8             	ltr    %ax
}
801084e1:	c9                   	leave  
801084e2:	c3                   	ret    

801084e3 <loadgs>:
  return eflags;
}

static inline void
loadgs(ushort v)
{
801084e3:	55                   	push   %ebp
801084e4:	89 e5                	mov    %esp,%ebp
801084e6:	83 ec 04             	sub    $0x4,%esp
801084e9:	8b 45 08             	mov    0x8(%ebp),%eax
801084ec:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  asm volatile("movw %0, %%gs" : : "r" (v));
801084f0:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
801084f4:	8e e8                	mov    %eax,%gs
}
801084f6:	c9                   	leave  
801084f7:	c3                   	ret    

801084f8 <lcr3>:
  return val;
}

static inline void
lcr3(uint val) 
{
801084f8:	55                   	push   %ebp
801084f9:	89 e5                	mov    %esp,%ebp
  asm volatile("movl %0,%%cr3" : : "r" (val));
801084fb:	8b 45 08             	mov    0x8(%ebp),%eax
801084fe:	0f 22 d8             	mov    %eax,%cr3
}
80108501:	5d                   	pop    %ebp
80108502:	c3                   	ret    

80108503 <v2p>:
#define KERNBASE 0x80000000         // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM)  // Address where kernel is linked

#ifndef __ASSEMBLER__

static inline uint v2p(void *a) { return ((uint) (a))  - KERNBASE; }
80108503:	55                   	push   %ebp
80108504:	89 e5                	mov    %esp,%ebp
80108506:	8b 45 08             	mov    0x8(%ebp),%eax
80108509:	05 00 00 00 80       	add    $0x80000000,%eax
8010850e:	5d                   	pop    %ebp
8010850f:	c3                   	ret    

80108510 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
80108510:	55                   	push   %ebp
80108511:	89 e5                	mov    %esp,%ebp
80108513:	8b 45 08             	mov    0x8(%ebp),%eax
80108516:	05 00 00 00 80       	add    $0x80000000,%eax
8010851b:	5d                   	pop    %ebp
8010851c:	c3                   	ret    

8010851d <seginit>:

// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
8010851d:	55                   	push   %ebp
8010851e:	89 e5                	mov    %esp,%ebp
80108520:	53                   	push   %ebx
80108521:	83 ec 24             	sub    $0x24,%esp

  // Map "logical" addresses to virtual addresses using identity map.
  // Cannot share a CODE descriptor for both kernel and user
  // because it would have to have DPL_USR, but the CPU forbids
  // an interrupt from CPL=0 to DPL=3.
  c = &cpus[cpunum()];
80108524:	e8 d0 a9 ff ff       	call   80102ef9 <cpunum>
80108529:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
8010852f:	05 80 09 11 80       	add    $0x80110980,%eax
80108534:	89 45 f4             	mov    %eax,-0xc(%ebp)
  c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
80108537:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010853a:	66 c7 40 78 ff ff    	movw   $0xffff,0x78(%eax)
80108540:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108543:	66 c7 40 7a 00 00    	movw   $0x0,0x7a(%eax)
80108549:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010854c:	c6 40 7c 00          	movb   $0x0,0x7c(%eax)
80108550:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108553:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80108557:	83 e2 f0             	and    $0xfffffff0,%edx
8010855a:	83 ca 0a             	or     $0xa,%edx
8010855d:	88 50 7d             	mov    %dl,0x7d(%eax)
80108560:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108563:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80108567:	83 ca 10             	or     $0x10,%edx
8010856a:	88 50 7d             	mov    %dl,0x7d(%eax)
8010856d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108570:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80108574:	83 e2 9f             	and    $0xffffff9f,%edx
80108577:	88 50 7d             	mov    %dl,0x7d(%eax)
8010857a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010857d:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80108581:	83 ca 80             	or     $0xffffff80,%edx
80108584:	88 50 7d             	mov    %dl,0x7d(%eax)
80108587:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010858a:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
8010858e:	83 ca 0f             	or     $0xf,%edx
80108591:	88 50 7e             	mov    %dl,0x7e(%eax)
80108594:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108597:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
8010859b:	83 e2 ef             	and    $0xffffffef,%edx
8010859e:	88 50 7e             	mov    %dl,0x7e(%eax)
801085a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085a4:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801085a8:	83 e2 df             	and    $0xffffffdf,%edx
801085ab:	88 50 7e             	mov    %dl,0x7e(%eax)
801085ae:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085b1:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801085b5:	83 ca 40             	or     $0x40,%edx
801085b8:	88 50 7e             	mov    %dl,0x7e(%eax)
801085bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085be:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
801085c2:	83 ca 80             	or     $0xffffff80,%edx
801085c5:	88 50 7e             	mov    %dl,0x7e(%eax)
801085c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085cb:	c6 40 7f 00          	movb   $0x0,0x7f(%eax)
  c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801085cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085d2:	66 c7 80 80 00 00 00 	movw   $0xffff,0x80(%eax)
801085d9:	ff ff 
801085db:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085de:	66 c7 80 82 00 00 00 	movw   $0x0,0x82(%eax)
801085e5:	00 00 
801085e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085ea:	c6 80 84 00 00 00 00 	movb   $0x0,0x84(%eax)
801085f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085f4:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
801085fb:	83 e2 f0             	and    $0xfffffff0,%edx
801085fe:	83 ca 02             	or     $0x2,%edx
80108601:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
80108607:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010860a:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
80108611:	83 ca 10             	or     $0x10,%edx
80108614:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
8010861a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010861d:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
80108624:	83 e2 9f             	and    $0xffffff9f,%edx
80108627:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
8010862d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108630:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
80108637:	83 ca 80             	or     $0xffffff80,%edx
8010863a:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
80108640:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108643:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
8010864a:	83 ca 0f             	or     $0xf,%edx
8010864d:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80108653:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108656:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
8010865d:	83 e2 ef             	and    $0xffffffef,%edx
80108660:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80108666:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108669:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80108670:	83 e2 df             	and    $0xffffffdf,%edx
80108673:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80108679:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010867c:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80108683:	83 ca 40             	or     $0x40,%edx
80108686:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
8010868c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010868f:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80108696:	83 ca 80             	or     $0xffffff80,%edx
80108699:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
8010869f:	8b 45 f4             	mov    -0xc(%ebp),%eax
801086a2:	c6 80 87 00 00 00 00 	movb   $0x0,0x87(%eax)
  c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801086a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801086ac:	66 c7 80 90 00 00 00 	movw   $0xffff,0x90(%eax)
801086b3:	ff ff 
801086b5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801086b8:	66 c7 80 92 00 00 00 	movw   $0x0,0x92(%eax)
801086bf:	00 00 
801086c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801086c4:	c6 80 94 00 00 00 00 	movb   $0x0,0x94(%eax)
801086cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801086ce:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801086d5:	83 e2 f0             	and    $0xfffffff0,%edx
801086d8:	83 ca 0a             	or     $0xa,%edx
801086db:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
801086e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801086e4:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801086eb:	83 ca 10             	or     $0x10,%edx
801086ee:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
801086f4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801086f7:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
801086fe:	83 ca 60             	or     $0x60,%edx
80108701:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
80108707:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010870a:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
80108711:	83 ca 80             	or     $0xffffff80,%edx
80108714:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
8010871a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010871d:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80108724:	83 ca 0f             	or     $0xf,%edx
80108727:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
8010872d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108730:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80108737:	83 e2 ef             	and    $0xffffffef,%edx
8010873a:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80108740:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108743:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
8010874a:	83 e2 df             	and    $0xffffffdf,%edx
8010874d:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80108753:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108756:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
8010875d:	83 ca 40             	or     $0x40,%edx
80108760:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80108766:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108769:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80108770:	83 ca 80             	or     $0xffffff80,%edx
80108773:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80108779:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010877c:	c6 80 97 00 00 00 00 	movb   $0x0,0x97(%eax)
  c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80108783:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108786:	66 c7 80 98 00 00 00 	movw   $0xffff,0x98(%eax)
8010878d:	ff ff 
8010878f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108792:	66 c7 80 9a 00 00 00 	movw   $0x0,0x9a(%eax)
80108799:	00 00 
8010879b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010879e:	c6 80 9c 00 00 00 00 	movb   $0x0,0x9c(%eax)
801087a5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801087a8:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
801087af:	83 e2 f0             	and    $0xfffffff0,%edx
801087b2:	83 ca 02             	or     $0x2,%edx
801087b5:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
801087bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801087be:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
801087c5:	83 ca 10             	or     $0x10,%edx
801087c8:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
801087ce:	8b 45 f4             	mov    -0xc(%ebp),%eax
801087d1:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
801087d8:	83 ca 60             	or     $0x60,%edx
801087db:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
801087e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801087e4:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
801087eb:	83 ca 80             	or     $0xffffff80,%edx
801087ee:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
801087f4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801087f7:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
801087fe:	83 ca 0f             	or     $0xf,%edx
80108801:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80108807:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010880a:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80108811:	83 e2 ef             	and    $0xffffffef,%edx
80108814:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
8010881a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010881d:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80108824:	83 e2 df             	and    $0xffffffdf,%edx
80108827:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
8010882d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108830:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80108837:	83 ca 40             	or     $0x40,%edx
8010883a:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80108840:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108843:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
8010884a:	83 ca 80             	or     $0xffffff80,%edx
8010884d:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80108853:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108856:	c6 80 9f 00 00 00 00 	movb   $0x0,0x9f(%eax)

  // Map cpu, and curproc
  c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
8010885d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108860:	05 b4 00 00 00       	add    $0xb4,%eax
80108865:	89 c3                	mov    %eax,%ebx
80108867:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010886a:	05 b4 00 00 00       	add    $0xb4,%eax
8010886f:	c1 e8 10             	shr    $0x10,%eax
80108872:	89 c1                	mov    %eax,%ecx
80108874:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108877:	05 b4 00 00 00       	add    $0xb4,%eax
8010887c:	c1 e8 18             	shr    $0x18,%eax
8010887f:	89 c2                	mov    %eax,%edx
80108881:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108884:	66 c7 80 88 00 00 00 	movw   $0x0,0x88(%eax)
8010888b:	00 00 
8010888d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108890:	66 89 98 8a 00 00 00 	mov    %bx,0x8a(%eax)
80108897:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010889a:	88 88 8c 00 00 00    	mov    %cl,0x8c(%eax)
801088a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801088a3:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
801088aa:	83 e1 f0             	and    $0xfffffff0,%ecx
801088ad:	83 c9 02             	or     $0x2,%ecx
801088b0:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
801088b6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801088b9:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
801088c0:	83 c9 10             	or     $0x10,%ecx
801088c3:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
801088c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801088cc:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
801088d3:	83 e1 9f             	and    $0xffffff9f,%ecx
801088d6:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
801088dc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801088df:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
801088e6:	83 c9 80             	or     $0xffffff80,%ecx
801088e9:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
801088ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
801088f2:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
801088f9:	83 e1 f0             	and    $0xfffffff0,%ecx
801088fc:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80108902:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108905:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
8010890c:	83 e1 ef             	and    $0xffffffef,%ecx
8010890f:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80108915:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108918:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
8010891f:	83 e1 df             	and    $0xffffffdf,%ecx
80108922:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80108928:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010892b:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
80108932:	83 c9 40             	or     $0x40,%ecx
80108935:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
8010893b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010893e:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
80108945:	83 c9 80             	or     $0xffffff80,%ecx
80108948:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
8010894e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108951:	88 90 8f 00 00 00    	mov    %dl,0x8f(%eax)

  lgdt(c->gdt, sizeof(c->gdt));
80108957:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010895a:	83 c0 70             	add    $0x70,%eax
8010895d:	c7 44 24 04 38 00 00 	movl   $0x38,0x4(%esp)
80108964:	00 
80108965:	89 04 24             	mov    %eax,(%esp)
80108968:	e8 37 fb ff ff       	call   801084a4 <lgdt>
  loadgs(SEG_KCPU << 3);
8010896d:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
80108974:	e8 6a fb ff ff       	call   801084e3 <loadgs>
  
  // Initialize cpu-local storage.
  cpu = c;
80108979:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010897c:	65 a3 00 00 00 00    	mov    %eax,%gs:0x0
  proc = 0;
80108982:	65 c7 05 04 00 00 00 	movl   $0x0,%gs:0x4
80108989:	00 00 00 00 
}
8010898d:	83 c4 24             	add    $0x24,%esp
80108990:	5b                   	pop    %ebx
80108991:	5d                   	pop    %ebp
80108992:	c3                   	ret    

80108993 <walkpgdir>:
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va.  If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
80108993:	55                   	push   %ebp
80108994:	89 e5                	mov    %esp,%ebp
80108996:	83 ec 28             	sub    $0x28,%esp
  pde_t *pde;
  pte_t *pgtab;

  pde = &pgdir[PDX(va)];
80108999:	8b 45 0c             	mov    0xc(%ebp),%eax
8010899c:	c1 e8 16             	shr    $0x16,%eax
8010899f:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
801089a6:	8b 45 08             	mov    0x8(%ebp),%eax
801089a9:	01 d0                	add    %edx,%eax
801089ab:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(*pde & PTE_P){
801089ae:	8b 45 f0             	mov    -0x10(%ebp),%eax
801089b1:	8b 00                	mov    (%eax),%eax
801089b3:	83 e0 01             	and    $0x1,%eax
801089b6:	85 c0                	test   %eax,%eax
801089b8:	74 17                	je     801089d1 <walkpgdir+0x3e>
    pgtab = (pte_t*)p2v(PTE_ADDR(*pde));
801089ba:	8b 45 f0             	mov    -0x10(%ebp),%eax
801089bd:	8b 00                	mov    (%eax),%eax
801089bf:	25 00 f0 ff ff       	and    $0xfffff000,%eax
801089c4:	89 04 24             	mov    %eax,(%esp)
801089c7:	e8 44 fb ff ff       	call   80108510 <p2v>
801089cc:	89 45 f4             	mov    %eax,-0xc(%ebp)
801089cf:	eb 4b                	jmp    80108a1c <walkpgdir+0x89>
  } else {
    if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
801089d1:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801089d5:	74 0e                	je     801089e5 <walkpgdir+0x52>
801089d7:	e8 8a a1 ff ff       	call   80102b66 <kalloc>
801089dc:	89 45 f4             	mov    %eax,-0xc(%ebp)
801089df:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801089e3:	75 07                	jne    801089ec <walkpgdir+0x59>
      return 0;
801089e5:	b8 00 00 00 00       	mov    $0x0,%eax
801089ea:	eb 47                	jmp    80108a33 <walkpgdir+0xa0>
    // Make sure all those PTE_P bits are zero.
    memset(pgtab, 0, PGSIZE);
801089ec:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801089f3:	00 
801089f4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801089fb:	00 
801089fc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801089ff:	89 04 24             	mov    %eax,(%esp)
80108a02:	e8 5b d4 ff ff       	call   80105e62 <memset>
    // The permissions here are overly generous, but they can
    // be further restricted by the permissions in the page table 
    // entries, if necessary.
    *pde = v2p(pgtab) | PTE_P | PTE_W | PTE_U;
80108a07:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108a0a:	89 04 24             	mov    %eax,(%esp)
80108a0d:	e8 f1 fa ff ff       	call   80108503 <v2p>
80108a12:	89 c2                	mov    %eax,%edx
80108a14:	83 ca 07             	or     $0x7,%edx
80108a17:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108a1a:	89 10                	mov    %edx,(%eax)
  }
  return &pgtab[PTX(va)];
80108a1c:	8b 45 0c             	mov    0xc(%ebp),%eax
80108a1f:	c1 e8 0c             	shr    $0xc,%eax
80108a22:	25 ff 03 00 00       	and    $0x3ff,%eax
80108a27:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80108a2e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108a31:	01 d0                	add    %edx,%eax
}
80108a33:	c9                   	leave  
80108a34:	c3                   	ret    

80108a35 <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
80108a35:	55                   	push   %ebp
80108a36:	89 e5                	mov    %esp,%ebp
80108a38:	83 ec 28             	sub    $0x28,%esp
  char *a, *last;
  pte_t *pte;
  
  a = (char*)PGROUNDDOWN((uint)va);
80108a3b:	8b 45 0c             	mov    0xc(%ebp),%eax
80108a3e:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108a43:	89 45 f4             	mov    %eax,-0xc(%ebp)
  last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80108a46:	8b 55 0c             	mov    0xc(%ebp),%edx
80108a49:	8b 45 10             	mov    0x10(%ebp),%eax
80108a4c:	01 d0                	add    %edx,%eax
80108a4e:	83 e8 01             	sub    $0x1,%eax
80108a51:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108a56:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(;;){
    if((pte = walkpgdir(pgdir, a, 1)) == 0)
80108a59:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
80108a60:	00 
80108a61:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108a64:	89 44 24 04          	mov    %eax,0x4(%esp)
80108a68:	8b 45 08             	mov    0x8(%ebp),%eax
80108a6b:	89 04 24             	mov    %eax,(%esp)
80108a6e:	e8 20 ff ff ff       	call   80108993 <walkpgdir>
80108a73:	89 45 ec             	mov    %eax,-0x14(%ebp)
80108a76:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80108a7a:	75 07                	jne    80108a83 <mappages+0x4e>
      return -1;
80108a7c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80108a81:	eb 46                	jmp    80108ac9 <mappages+0x94>
    if(*pte & PTE_P)
80108a83:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108a86:	8b 00                	mov    (%eax),%eax
80108a88:	83 e0 01             	and    $0x1,%eax
80108a8b:	85 c0                	test   %eax,%eax
80108a8d:	74 0c                	je     80108a9b <mappages+0x66>
      panic("remap");
80108a8f:	c7 04 24 8c 99 10 80 	movl   $0x8010998c,(%esp)
80108a96:	e8 97 7a ff ff       	call   80100532 <panic>
    *pte = pa | perm | PTE_P;
80108a9b:	8b 45 18             	mov    0x18(%ebp),%eax
80108a9e:	0b 45 14             	or     0x14(%ebp),%eax
80108aa1:	89 c2                	mov    %eax,%edx
80108aa3:	83 ca 01             	or     $0x1,%edx
80108aa6:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108aa9:	89 10                	mov    %edx,(%eax)
    if(a == last)
80108aab:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108aae:	3b 45 f0             	cmp    -0x10(%ebp),%eax
80108ab1:	74 10                	je     80108ac3 <mappages+0x8e>
      break;
    a += PGSIZE;
80108ab3:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
    pa += PGSIZE;
80108aba:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
  }
80108ac1:	eb 96                	jmp    80108a59 <mappages+0x24>
      return -1;
    if(*pte & PTE_P)
      panic("remap");
    *pte = pa | perm | PTE_P;
    if(a == last)
      break;
80108ac3:	90                   	nop
    a += PGSIZE;
    pa += PGSIZE;
  }
  return 0;
80108ac4:	b8 00 00 00 00       	mov    $0x0,%eax
}
80108ac9:	c9                   	leave  
80108aca:	c3                   	ret    

80108acb <setupkvm>:
};

// Set up kernel part of a page table.
pde_t*
setupkvm()
{
80108acb:	55                   	push   %ebp
80108acc:	89 e5                	mov    %esp,%ebp
80108ace:	53                   	push   %ebx
80108acf:	83 ec 34             	sub    $0x34,%esp
  pde_t *pgdir;
  struct kmap *k;

  if((pgdir = (pde_t*)kalloc()) == 0)
80108ad2:	e8 8f a0 ff ff       	call   80102b66 <kalloc>
80108ad7:	89 45 f0             	mov    %eax,-0x10(%ebp)
80108ada:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80108ade:	75 0a                	jne    80108aea <setupkvm+0x1f>
    return 0;
80108ae0:	b8 00 00 00 00       	mov    $0x0,%eax
80108ae5:	e9 98 00 00 00       	jmp    80108b82 <setupkvm+0xb7>
  memset(pgdir, 0, PGSIZE);
80108aea:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80108af1:	00 
80108af2:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80108af9:	00 
80108afa:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108afd:	89 04 24             	mov    %eax,(%esp)
80108b00:	e8 5d d3 ff ff       	call   80105e62 <memset>
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
80108b05:	c7 04 24 00 00 00 0e 	movl   $0xe000000,(%esp)
80108b0c:	e8 ff f9 ff ff       	call   80108510 <p2v>
80108b11:	3d 00 00 00 fe       	cmp    $0xfe000000,%eax
80108b16:	76 0c                	jbe    80108b24 <setupkvm+0x59>
    panic("PHYSTOP too high");
80108b18:	c7 04 24 92 99 10 80 	movl   $0x80109992,(%esp)
80108b1f:	e8 0e 7a ff ff       	call   80100532 <panic>
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80108b24:	c7 45 f4 00 c5 10 80 	movl   $0x8010c500,-0xc(%ebp)
80108b2b:	eb 49                	jmp    80108b76 <setupkvm+0xab>
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 
                (uint)k->phys_start, k->perm) < 0)
80108b2d:	8b 45 f4             	mov    -0xc(%ebp),%eax
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 
80108b30:	8b 48 0c             	mov    0xc(%eax),%ecx
                (uint)k->phys_start, k->perm) < 0)
80108b33:	8b 45 f4             	mov    -0xc(%ebp),%eax
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 
80108b36:	8b 50 04             	mov    0x4(%eax),%edx
80108b39:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108b3c:	8b 58 08             	mov    0x8(%eax),%ebx
80108b3f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108b42:	8b 40 04             	mov    0x4(%eax),%eax
80108b45:	29 c3                	sub    %eax,%ebx
80108b47:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108b4a:	8b 00                	mov    (%eax),%eax
80108b4c:	89 4c 24 10          	mov    %ecx,0x10(%esp)
80108b50:	89 54 24 0c          	mov    %edx,0xc(%esp)
80108b54:	89 5c 24 08          	mov    %ebx,0x8(%esp)
80108b58:	89 44 24 04          	mov    %eax,0x4(%esp)
80108b5c:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108b5f:	89 04 24             	mov    %eax,(%esp)
80108b62:	e8 ce fe ff ff       	call   80108a35 <mappages>
80108b67:	85 c0                	test   %eax,%eax
80108b69:	79 07                	jns    80108b72 <setupkvm+0xa7>
                (uint)k->phys_start, k->perm) < 0)
      return 0;
80108b6b:	b8 00 00 00 00       	mov    $0x0,%eax
80108b70:	eb 10                	jmp    80108b82 <setupkvm+0xb7>
  if((pgdir = (pde_t*)kalloc()) == 0)
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80108b72:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
80108b76:	81 7d f4 40 c5 10 80 	cmpl   $0x8010c540,-0xc(%ebp)
80108b7d:	72 ae                	jb     80108b2d <setupkvm+0x62>
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 
                (uint)k->phys_start, k->perm) < 0)
      return 0;
  return pgdir;
80108b7f:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80108b82:	83 c4 34             	add    $0x34,%esp
80108b85:	5b                   	pop    %ebx
80108b86:	5d                   	pop    %ebp
80108b87:	c3                   	ret    

80108b88 <kvmalloc>:

// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
80108b88:	55                   	push   %ebp
80108b89:	89 e5                	mov    %esp,%ebp
80108b8b:	83 ec 08             	sub    $0x8,%esp
  kpgdir = setupkvm();
80108b8e:	e8 38 ff ff ff       	call   80108acb <setupkvm>
80108b93:	a3 98 7a 11 80       	mov    %eax,0x80117a98
  switchkvm();
80108b98:	e8 02 00 00 00       	call   80108b9f <switchkvm>
}
80108b9d:	c9                   	leave  
80108b9e:	c3                   	ret    

80108b9f <switchkvm>:

// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
80108b9f:	55                   	push   %ebp
80108ba0:	89 e5                	mov    %esp,%ebp
80108ba2:	83 ec 04             	sub    $0x4,%esp
  lcr3(v2p(kpgdir));   // switch to the kernel page table
80108ba5:	a1 98 7a 11 80       	mov    0x80117a98,%eax
80108baa:	89 04 24             	mov    %eax,(%esp)
80108bad:	e8 51 f9 ff ff       	call   80108503 <v2p>
80108bb2:	89 04 24             	mov    %eax,(%esp)
80108bb5:	e8 3e f9 ff ff       	call   801084f8 <lcr3>
}
80108bba:	c9                   	leave  
80108bbb:	c3                   	ret    

80108bbc <switchuvm>:

// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80108bbc:	55                   	push   %ebp
80108bbd:	89 e5                	mov    %esp,%ebp
80108bbf:	53                   	push   %ebx
80108bc0:	83 ec 14             	sub    $0x14,%esp
  pushcli();
80108bc3:	e8 93 d1 ff ff       	call   80105d5b <pushcli>
  cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80108bc8:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80108bce:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80108bd5:	83 c2 08             	add    $0x8,%edx
80108bd8:	89 d3                	mov    %edx,%ebx
80108bda:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80108be1:	83 c2 08             	add    $0x8,%edx
80108be4:	c1 ea 10             	shr    $0x10,%edx
80108be7:	89 d1                	mov    %edx,%ecx
80108be9:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80108bf0:	83 c2 08             	add    $0x8,%edx
80108bf3:	c1 ea 18             	shr    $0x18,%edx
80108bf6:	66 c7 80 a0 00 00 00 	movw   $0x67,0xa0(%eax)
80108bfd:	67 00 
80108bff:	66 89 98 a2 00 00 00 	mov    %bx,0xa2(%eax)
80108c06:	88 88 a4 00 00 00    	mov    %cl,0xa4(%eax)
80108c0c:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80108c13:	83 e1 f0             	and    $0xfffffff0,%ecx
80108c16:	83 c9 09             	or     $0x9,%ecx
80108c19:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80108c1f:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80108c26:	83 c9 10             	or     $0x10,%ecx
80108c29:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80108c2f:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80108c36:	83 e1 9f             	and    $0xffffff9f,%ecx
80108c39:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80108c3f:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80108c46:	83 c9 80             	or     $0xffffff80,%ecx
80108c49:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80108c4f:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80108c56:	83 e1 f0             	and    $0xfffffff0,%ecx
80108c59:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108c5f:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80108c66:	83 e1 ef             	and    $0xffffffef,%ecx
80108c69:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108c6f:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80108c76:	83 e1 df             	and    $0xffffffdf,%ecx
80108c79:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108c7f:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80108c86:	83 c9 40             	or     $0x40,%ecx
80108c89:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108c8f:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
80108c96:	83 e1 7f             	and    $0x7f,%ecx
80108c99:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108c9f:	88 90 a7 00 00 00    	mov    %dl,0xa7(%eax)
  cpu->gdt[SEG_TSS].s = 0;
80108ca5:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80108cab:	0f b6 90 a5 00 00 00 	movzbl 0xa5(%eax),%edx
80108cb2:	83 e2 ef             	and    $0xffffffef,%edx
80108cb5:	88 90 a5 00 00 00    	mov    %dl,0xa5(%eax)
  cpu->ts.ss0 = SEG_KDATA << 3;
80108cbb:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80108cc1:	66 c7 40 10 10 00    	movw   $0x10,0x10(%eax)
  cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
80108cc7:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80108ccd:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
80108cd4:	8b 52 08             	mov    0x8(%edx),%edx
80108cd7:	81 c2 00 10 00 00    	add    $0x1000,%edx
80108cdd:	89 50 0c             	mov    %edx,0xc(%eax)
  ltr(SEG_TSS << 3);
80108ce0:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
80108ce7:	e8 e1 f7 ff ff       	call   801084cd <ltr>
  if(p->pgdir == 0)
80108cec:	8b 45 08             	mov    0x8(%ebp),%eax
80108cef:	8b 40 04             	mov    0x4(%eax),%eax
80108cf2:	85 c0                	test   %eax,%eax
80108cf4:	75 0c                	jne    80108d02 <switchuvm+0x146>
    panic("switchuvm: no pgdir");
80108cf6:	c7 04 24 a3 99 10 80 	movl   $0x801099a3,(%esp)
80108cfd:	e8 30 78 ff ff       	call   80100532 <panic>
  lcr3(v2p(p->pgdir));  // switch to new address space
80108d02:	8b 45 08             	mov    0x8(%ebp),%eax
80108d05:	8b 40 04             	mov    0x4(%eax),%eax
80108d08:	89 04 24             	mov    %eax,(%esp)
80108d0b:	e8 f3 f7 ff ff       	call   80108503 <v2p>
80108d10:	89 04 24             	mov    %eax,(%esp)
80108d13:	e8 e0 f7 ff ff       	call   801084f8 <lcr3>
  popcli();
80108d18:	e8 86 d0 ff ff       	call   80105da3 <popcli>
}
80108d1d:	83 c4 14             	add    $0x14,%esp
80108d20:	5b                   	pop    %ebx
80108d21:	5d                   	pop    %ebp
80108d22:	c3                   	ret    

80108d23 <inituvm>:

// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
80108d23:	55                   	push   %ebp
80108d24:	89 e5                	mov    %esp,%ebp
80108d26:	83 ec 38             	sub    $0x38,%esp
  char *mem;
  
  if(sz >= PGSIZE)
80108d29:	81 7d 10 ff 0f 00 00 	cmpl   $0xfff,0x10(%ebp)
80108d30:	76 0c                	jbe    80108d3e <inituvm+0x1b>
    panic("inituvm: more than a page");
80108d32:	c7 04 24 b7 99 10 80 	movl   $0x801099b7,(%esp)
80108d39:	e8 f4 77 ff ff       	call   80100532 <panic>
  mem = kalloc();
80108d3e:	e8 23 9e ff ff       	call   80102b66 <kalloc>
80108d43:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memset(mem, 0, PGSIZE);
80108d46:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80108d4d:	00 
80108d4e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80108d55:	00 
80108d56:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108d59:	89 04 24             	mov    %eax,(%esp)
80108d5c:	e8 01 d1 ff ff       	call   80105e62 <memset>
  mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U);
80108d61:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108d64:	89 04 24             	mov    %eax,(%esp)
80108d67:	e8 97 f7 ff ff       	call   80108503 <v2p>
80108d6c:	c7 44 24 10 06 00 00 	movl   $0x6,0x10(%esp)
80108d73:	00 
80108d74:	89 44 24 0c          	mov    %eax,0xc(%esp)
80108d78:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80108d7f:	00 
80108d80:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80108d87:	00 
80108d88:	8b 45 08             	mov    0x8(%ebp),%eax
80108d8b:	89 04 24             	mov    %eax,(%esp)
80108d8e:	e8 a2 fc ff ff       	call   80108a35 <mappages>
  memmove(mem, init, sz);
80108d93:	8b 45 10             	mov    0x10(%ebp),%eax
80108d96:	89 44 24 08          	mov    %eax,0x8(%esp)
80108d9a:	8b 45 0c             	mov    0xc(%ebp),%eax
80108d9d:	89 44 24 04          	mov    %eax,0x4(%esp)
80108da1:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108da4:	89 04 24             	mov    %eax,(%esp)
80108da7:	e8 89 d1 ff ff       	call   80105f35 <memmove>
}
80108dac:	c9                   	leave  
80108dad:	c3                   	ret    

80108dae <loaduvm>:

// Load a program segment into pgdir.  addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
80108dae:	55                   	push   %ebp
80108daf:	89 e5                	mov    %esp,%ebp
80108db1:	53                   	push   %ebx
80108db2:	83 ec 24             	sub    $0x24,%esp
  uint i, pa, n;
  pte_t *pte;

  if((uint) addr % PGSIZE != 0)
80108db5:	8b 45 0c             	mov    0xc(%ebp),%eax
80108db8:	25 ff 0f 00 00       	and    $0xfff,%eax
80108dbd:	85 c0                	test   %eax,%eax
80108dbf:	74 0c                	je     80108dcd <loaduvm+0x1f>
    panic("loaduvm: addr must be page aligned");
80108dc1:	c7 04 24 d4 99 10 80 	movl   $0x801099d4,(%esp)
80108dc8:	e8 65 77 ff ff       	call   80100532 <panic>
  for(i = 0; i < sz; i += PGSIZE){
80108dcd:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80108dd4:	e9 ad 00 00 00       	jmp    80108e86 <loaduvm+0xd8>
    if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
80108dd9:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108ddc:	8b 55 0c             	mov    0xc(%ebp),%edx
80108ddf:	01 d0                	add    %edx,%eax
80108de1:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80108de8:	00 
80108de9:	89 44 24 04          	mov    %eax,0x4(%esp)
80108ded:	8b 45 08             	mov    0x8(%ebp),%eax
80108df0:	89 04 24             	mov    %eax,(%esp)
80108df3:	e8 9b fb ff ff       	call   80108993 <walkpgdir>
80108df8:	89 45 ec             	mov    %eax,-0x14(%ebp)
80108dfb:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80108dff:	75 0c                	jne    80108e0d <loaduvm+0x5f>
      panic("loaduvm: address should exist");
80108e01:	c7 04 24 f7 99 10 80 	movl   $0x801099f7,(%esp)
80108e08:	e8 25 77 ff ff       	call   80100532 <panic>
    pa = PTE_ADDR(*pte);
80108e0d:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108e10:	8b 00                	mov    (%eax),%eax
80108e12:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108e17:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if(sz - i < PGSIZE)
80108e1a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108e1d:	8b 55 18             	mov    0x18(%ebp),%edx
80108e20:	89 d1                	mov    %edx,%ecx
80108e22:	29 c1                	sub    %eax,%ecx
80108e24:	89 c8                	mov    %ecx,%eax
80108e26:	3d ff 0f 00 00       	cmp    $0xfff,%eax
80108e2b:	77 11                	ja     80108e3e <loaduvm+0x90>
      n = sz - i;
80108e2d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108e30:	8b 55 18             	mov    0x18(%ebp),%edx
80108e33:	89 d1                	mov    %edx,%ecx
80108e35:	29 c1                	sub    %eax,%ecx
80108e37:	89 c8                	mov    %ecx,%eax
80108e39:	89 45 f0             	mov    %eax,-0x10(%ebp)
80108e3c:	eb 07                	jmp    80108e45 <loaduvm+0x97>
    else
      n = PGSIZE;
80108e3e:	c7 45 f0 00 10 00 00 	movl   $0x1000,-0x10(%ebp)
    if(readi(ip, p2v(pa), offset+i, n) != n)
80108e45:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108e48:	8b 55 14             	mov    0x14(%ebp),%edx
80108e4b:	8d 1c 02             	lea    (%edx,%eax,1),%ebx
80108e4e:	8b 45 e8             	mov    -0x18(%ebp),%eax
80108e51:	89 04 24             	mov    %eax,(%esp)
80108e54:	e8 b7 f6 ff ff       	call   80108510 <p2v>
80108e59:	8b 55 f0             	mov    -0x10(%ebp),%edx
80108e5c:	89 54 24 0c          	mov    %edx,0xc(%esp)
80108e60:	89 5c 24 08          	mov    %ebx,0x8(%esp)
80108e64:	89 44 24 04          	mov    %eax,0x4(%esp)
80108e68:	8b 45 10             	mov    0x10(%ebp),%eax
80108e6b:	89 04 24             	mov    %eax,(%esp)
80108e6e:	e8 06 8f ff ff       	call   80101d79 <readi>
80108e73:	3b 45 f0             	cmp    -0x10(%ebp),%eax
80108e76:	74 07                	je     80108e7f <loaduvm+0xd1>
      return -1;
80108e78:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80108e7d:	eb 18                	jmp    80108e97 <loaduvm+0xe9>
  uint i, pa, n;
  pte_t *pte;

  if((uint) addr % PGSIZE != 0)
    panic("loaduvm: addr must be page aligned");
  for(i = 0; i < sz; i += PGSIZE){
80108e7f:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80108e86:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108e89:	3b 45 18             	cmp    0x18(%ebp),%eax
80108e8c:	0f 82 47 ff ff ff    	jb     80108dd9 <loaduvm+0x2b>
    else
      n = PGSIZE;
    if(readi(ip, p2v(pa), offset+i, n) != n)
      return -1;
  }
  return 0;
80108e92:	b8 00 00 00 00       	mov    $0x0,%eax
}
80108e97:	83 c4 24             	add    $0x24,%esp
80108e9a:	5b                   	pop    %ebx
80108e9b:	5d                   	pop    %ebp
80108e9c:	c3                   	ret    

80108e9d <allocuvm>:

// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned.  Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80108e9d:	55                   	push   %ebp
80108e9e:	89 e5                	mov    %esp,%ebp
80108ea0:	83 ec 38             	sub    $0x38,%esp
  char *mem;
  uint a;

  if(newsz >= KERNBASE)
80108ea3:	8b 45 10             	mov    0x10(%ebp),%eax
80108ea6:	85 c0                	test   %eax,%eax
80108ea8:	79 0a                	jns    80108eb4 <allocuvm+0x17>
    return 0;
80108eaa:	b8 00 00 00 00       	mov    $0x0,%eax
80108eaf:	e9 c1 00 00 00       	jmp    80108f75 <allocuvm+0xd8>
  if(newsz < oldsz)
80108eb4:	8b 45 10             	mov    0x10(%ebp),%eax
80108eb7:	3b 45 0c             	cmp    0xc(%ebp),%eax
80108eba:	73 08                	jae    80108ec4 <allocuvm+0x27>
    return oldsz;
80108ebc:	8b 45 0c             	mov    0xc(%ebp),%eax
80108ebf:	e9 b1 00 00 00       	jmp    80108f75 <allocuvm+0xd8>

  a = PGROUNDUP(oldsz);
80108ec4:	8b 45 0c             	mov    0xc(%ebp),%eax
80108ec7:	05 ff 0f 00 00       	add    $0xfff,%eax
80108ecc:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108ed1:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; a < newsz; a += PGSIZE){
80108ed4:	e9 8d 00 00 00       	jmp    80108f66 <allocuvm+0xc9>
    mem = kalloc();
80108ed9:	e8 88 9c ff ff       	call   80102b66 <kalloc>
80108ede:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(mem == 0){
80108ee1:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80108ee5:	75 2c                	jne    80108f13 <allocuvm+0x76>
      cprintf("allocuvm out of memory\n");
80108ee7:	c7 04 24 15 9a 10 80 	movl   $0x80109a15,(%esp)
80108eee:	e8 a3 74 ff ff       	call   80100396 <cprintf>
      deallocuvm(pgdir, newsz, oldsz);
80108ef3:	8b 45 0c             	mov    0xc(%ebp),%eax
80108ef6:	89 44 24 08          	mov    %eax,0x8(%esp)
80108efa:	8b 45 10             	mov    0x10(%ebp),%eax
80108efd:	89 44 24 04          	mov    %eax,0x4(%esp)
80108f01:	8b 45 08             	mov    0x8(%ebp),%eax
80108f04:	89 04 24             	mov    %eax,(%esp)
80108f07:	e8 6b 00 00 00       	call   80108f77 <deallocuvm>
      return 0;
80108f0c:	b8 00 00 00 00       	mov    $0x0,%eax
80108f11:	eb 62                	jmp    80108f75 <allocuvm+0xd8>
    }
    memset(mem, 0, PGSIZE);
80108f13:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80108f1a:	00 
80108f1b:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80108f22:	00 
80108f23:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108f26:	89 04 24             	mov    %eax,(%esp)
80108f29:	e8 34 cf ff ff       	call   80105e62 <memset>
    mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
80108f2e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108f31:	89 04 24             	mov    %eax,(%esp)
80108f34:	e8 ca f5 ff ff       	call   80108503 <v2p>
80108f39:	8b 55 f4             	mov    -0xc(%ebp),%edx
80108f3c:	c7 44 24 10 06 00 00 	movl   $0x6,0x10(%esp)
80108f43:	00 
80108f44:	89 44 24 0c          	mov    %eax,0xc(%esp)
80108f48:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80108f4f:	00 
80108f50:	89 54 24 04          	mov    %edx,0x4(%esp)
80108f54:	8b 45 08             	mov    0x8(%ebp),%eax
80108f57:	89 04 24             	mov    %eax,(%esp)
80108f5a:	e8 d6 fa ff ff       	call   80108a35 <mappages>
    return 0;
  if(newsz < oldsz)
    return oldsz;

  a = PGROUNDUP(oldsz);
  for(; a < newsz; a += PGSIZE){
80108f5f:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80108f66:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108f69:	3b 45 10             	cmp    0x10(%ebp),%eax
80108f6c:	0f 82 67 ff ff ff    	jb     80108ed9 <allocuvm+0x3c>
      return 0;
    }
    memset(mem, 0, PGSIZE);
    mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
  }
  return newsz;
80108f72:	8b 45 10             	mov    0x10(%ebp),%eax
}
80108f75:	c9                   	leave  
80108f76:	c3                   	ret    

80108f77 <deallocuvm>:
// newsz.  oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz.  oldsz can be larger than the actual
// process size.  Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80108f77:	55                   	push   %ebp
80108f78:	89 e5                	mov    %esp,%ebp
80108f7a:	83 ec 28             	sub    $0x28,%esp
  pte_t *pte;
  uint a, pa;

  if(newsz >= oldsz)
80108f7d:	8b 45 10             	mov    0x10(%ebp),%eax
80108f80:	3b 45 0c             	cmp    0xc(%ebp),%eax
80108f83:	72 08                	jb     80108f8d <deallocuvm+0x16>
    return oldsz;
80108f85:	8b 45 0c             	mov    0xc(%ebp),%eax
80108f88:	e9 a4 00 00 00       	jmp    80109031 <deallocuvm+0xba>

  a = PGROUNDUP(newsz);
80108f8d:	8b 45 10             	mov    0x10(%ebp),%eax
80108f90:	05 ff 0f 00 00       	add    $0xfff,%eax
80108f95:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108f9a:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; a  < oldsz; a += PGSIZE){
80108f9d:	e9 80 00 00 00       	jmp    80109022 <deallocuvm+0xab>
    pte = walkpgdir(pgdir, (char*)a, 0);
80108fa2:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108fa5:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80108fac:	00 
80108fad:	89 44 24 04          	mov    %eax,0x4(%esp)
80108fb1:	8b 45 08             	mov    0x8(%ebp),%eax
80108fb4:	89 04 24             	mov    %eax,(%esp)
80108fb7:	e8 d7 f9 ff ff       	call   80108993 <walkpgdir>
80108fbc:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(!pte)
80108fbf:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80108fc3:	75 09                	jne    80108fce <deallocuvm+0x57>
      a += (NPTENTRIES - 1) * PGSIZE;
80108fc5:	81 45 f4 00 f0 3f 00 	addl   $0x3ff000,-0xc(%ebp)
80108fcc:	eb 4d                	jmp    8010901b <deallocuvm+0xa4>
    else if((*pte & PTE_P) != 0){
80108fce:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108fd1:	8b 00                	mov    (%eax),%eax
80108fd3:	83 e0 01             	and    $0x1,%eax
80108fd6:	85 c0                	test   %eax,%eax
80108fd8:	74 41                	je     8010901b <deallocuvm+0xa4>
      pa = PTE_ADDR(*pte);
80108fda:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108fdd:	8b 00                	mov    (%eax),%eax
80108fdf:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108fe4:	89 45 ec             	mov    %eax,-0x14(%ebp)
      if(pa == 0)
80108fe7:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80108feb:	75 0c                	jne    80108ff9 <deallocuvm+0x82>
        panic("kfree");
80108fed:	c7 04 24 2d 9a 10 80 	movl   $0x80109a2d,(%esp)
80108ff4:	e8 39 75 ff ff       	call   80100532 <panic>
      char *v = p2v(pa);
80108ff9:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108ffc:	89 04 24             	mov    %eax,(%esp)
80108fff:	e8 0c f5 ff ff       	call   80108510 <p2v>
80109004:	89 45 e8             	mov    %eax,-0x18(%ebp)
      kfree(v);
80109007:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010900a:	89 04 24             	mov    %eax,(%esp)
8010900d:	e8 60 9a ff ff       	call   80102a72 <kfree>
      *pte = 0;
80109012:	8b 45 f0             	mov    -0x10(%ebp),%eax
80109015:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

  if(newsz >= oldsz)
    return oldsz;

  a = PGROUNDUP(newsz);
  for(; a  < oldsz; a += PGSIZE){
8010901b:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80109022:	8b 45 f4             	mov    -0xc(%ebp),%eax
80109025:	3b 45 0c             	cmp    0xc(%ebp),%eax
80109028:	0f 82 74 ff ff ff    	jb     80108fa2 <deallocuvm+0x2b>
      char *v = p2v(pa);
      kfree(v);
      *pte = 0;
    }
  }
  return newsz;
8010902e:	8b 45 10             	mov    0x10(%ebp),%eax
}
80109031:	c9                   	leave  
80109032:	c3                   	ret    

80109033 <freevm>:

// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
80109033:	55                   	push   %ebp
80109034:	89 e5                	mov    %esp,%ebp
80109036:	83 ec 28             	sub    $0x28,%esp
  uint i;

  if(pgdir == 0)
80109039:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010903d:	75 0c                	jne    8010904b <freevm+0x18>
    panic("freevm: no pgdir");
8010903f:	c7 04 24 33 9a 10 80 	movl   $0x80109a33,(%esp)
80109046:	e8 e7 74 ff ff       	call   80100532 <panic>
  deallocuvm(pgdir, KERNBASE, 0);
8010904b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80109052:	00 
80109053:	c7 44 24 04 00 00 00 	movl   $0x80000000,0x4(%esp)
8010905a:	80 
8010905b:	8b 45 08             	mov    0x8(%ebp),%eax
8010905e:	89 04 24             	mov    %eax,(%esp)
80109061:	e8 11 ff ff ff       	call   80108f77 <deallocuvm>
  for(i = 0; i < NPDENTRIES; i++){
80109066:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010906d:	eb 48                	jmp    801090b7 <freevm+0x84>
    if(pgdir[i] & PTE_P){
8010906f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80109072:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80109079:	8b 45 08             	mov    0x8(%ebp),%eax
8010907c:	01 d0                	add    %edx,%eax
8010907e:	8b 00                	mov    (%eax),%eax
80109080:	83 e0 01             	and    $0x1,%eax
80109083:	85 c0                	test   %eax,%eax
80109085:	74 2c                	je     801090b3 <freevm+0x80>
      char * v = p2v(PTE_ADDR(pgdir[i]));
80109087:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010908a:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80109091:	8b 45 08             	mov    0x8(%ebp),%eax
80109094:	01 d0                	add    %edx,%eax
80109096:	8b 00                	mov    (%eax),%eax
80109098:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010909d:	89 04 24             	mov    %eax,(%esp)
801090a0:	e8 6b f4 ff ff       	call   80108510 <p2v>
801090a5:	89 45 f0             	mov    %eax,-0x10(%ebp)
      kfree(v);
801090a8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801090ab:	89 04 24             	mov    %eax,(%esp)
801090ae:	e8 bf 99 ff ff       	call   80102a72 <kfree>
  uint i;

  if(pgdir == 0)
    panic("freevm: no pgdir");
  deallocuvm(pgdir, KERNBASE, 0);
  for(i = 0; i < NPDENTRIES; i++){
801090b3:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801090b7:	81 7d f4 ff 03 00 00 	cmpl   $0x3ff,-0xc(%ebp)
801090be:	76 af                	jbe    8010906f <freevm+0x3c>
    if(pgdir[i] & PTE_P){
      char * v = p2v(PTE_ADDR(pgdir[i]));
      kfree(v);
    }
  }
  kfree((char*)pgdir);
801090c0:	8b 45 08             	mov    0x8(%ebp),%eax
801090c3:	89 04 24             	mov    %eax,(%esp)
801090c6:	e8 a7 99 ff ff       	call   80102a72 <kfree>
}
801090cb:	c9                   	leave  
801090cc:	c3                   	ret    

801090cd <clearpteu>:

// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
801090cd:	55                   	push   %ebp
801090ce:	89 e5                	mov    %esp,%ebp
801090d0:	83 ec 28             	sub    $0x28,%esp
  pte_t *pte;

  pte = walkpgdir(pgdir, uva, 0);
801090d3:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
801090da:	00 
801090db:	8b 45 0c             	mov    0xc(%ebp),%eax
801090de:	89 44 24 04          	mov    %eax,0x4(%esp)
801090e2:	8b 45 08             	mov    0x8(%ebp),%eax
801090e5:	89 04 24             	mov    %eax,(%esp)
801090e8:	e8 a6 f8 ff ff       	call   80108993 <walkpgdir>
801090ed:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(pte == 0)
801090f0:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801090f4:	75 0c                	jne    80109102 <clearpteu+0x35>
    panic("clearpteu");
801090f6:	c7 04 24 44 9a 10 80 	movl   $0x80109a44,(%esp)
801090fd:	e8 30 74 ff ff       	call   80100532 <panic>
  *pte &= ~PTE_U;
80109102:	8b 45 f4             	mov    -0xc(%ebp),%eax
80109105:	8b 00                	mov    (%eax),%eax
80109107:	89 c2                	mov    %eax,%edx
80109109:	83 e2 fb             	and    $0xfffffffb,%edx
8010910c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010910f:	89 10                	mov    %edx,(%eax)
}
80109111:	c9                   	leave  
80109112:	c3                   	ret    

80109113 <copyuvm>:

// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
80109113:	55                   	push   %ebp
80109114:	89 e5                	mov    %esp,%ebp
80109116:	83 ec 48             	sub    $0x48,%esp
  pde_t *d;
  pte_t *pte;
  uint pa, i;
  char *mem;

  if((d = setupkvm()) == 0)
80109119:	e8 ad f9 ff ff       	call   80108acb <setupkvm>
8010911e:	89 45 f0             	mov    %eax,-0x10(%ebp)
80109121:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80109125:	75 0a                	jne    80109131 <copyuvm+0x1e>
    return 0;
80109127:	b8 00 00 00 00       	mov    $0x0,%eax
8010912c:	e9 f1 00 00 00       	jmp    80109222 <copyuvm+0x10f>
  for(i = 0; i < sz; i += PGSIZE){
80109131:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80109138:	e9 c0 00 00 00       	jmp    801091fd <copyuvm+0xea>
    if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
8010913d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80109140:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80109147:	00 
80109148:	89 44 24 04          	mov    %eax,0x4(%esp)
8010914c:	8b 45 08             	mov    0x8(%ebp),%eax
8010914f:	89 04 24             	mov    %eax,(%esp)
80109152:	e8 3c f8 ff ff       	call   80108993 <walkpgdir>
80109157:	89 45 ec             	mov    %eax,-0x14(%ebp)
8010915a:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
8010915e:	75 0c                	jne    8010916c <copyuvm+0x59>
      panic("copyuvm: pte should exist");
80109160:	c7 04 24 4e 9a 10 80 	movl   $0x80109a4e,(%esp)
80109167:	e8 c6 73 ff ff       	call   80100532 <panic>
    if(!(*pte & PTE_P))
8010916c:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010916f:	8b 00                	mov    (%eax),%eax
80109171:	83 e0 01             	and    $0x1,%eax
80109174:	85 c0                	test   %eax,%eax
80109176:	75 0c                	jne    80109184 <copyuvm+0x71>
      panic("copyuvm: page not present");
80109178:	c7 04 24 68 9a 10 80 	movl   $0x80109a68,(%esp)
8010917f:	e8 ae 73 ff ff       	call   80100532 <panic>
    pa = PTE_ADDR(*pte);
80109184:	8b 45 ec             	mov    -0x14(%ebp),%eax
80109187:	8b 00                	mov    (%eax),%eax
80109189:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010918e:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if((mem = kalloc()) == 0)
80109191:	e8 d0 99 ff ff       	call   80102b66 <kalloc>
80109196:	89 45 e4             	mov    %eax,-0x1c(%ebp)
80109199:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
8010919d:	74 6f                	je     8010920e <copyuvm+0xfb>
      goto bad;
    memmove(mem, (char*)p2v(pa), PGSIZE);
8010919f:	8b 45 e8             	mov    -0x18(%ebp),%eax
801091a2:	89 04 24             	mov    %eax,(%esp)
801091a5:	e8 66 f3 ff ff       	call   80108510 <p2v>
801091aa:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801091b1:	00 
801091b2:	89 44 24 04          	mov    %eax,0x4(%esp)
801091b6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801091b9:	89 04 24             	mov    %eax,(%esp)
801091bc:	e8 74 cd ff ff       	call   80105f35 <memmove>
    if(mappages(d, (void*)i, PGSIZE, v2p(mem), PTE_W|PTE_U) < 0)
801091c1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801091c4:	89 04 24             	mov    %eax,(%esp)
801091c7:	e8 37 f3 ff ff       	call   80108503 <v2p>
801091cc:	8b 55 f4             	mov    -0xc(%ebp),%edx
801091cf:	c7 44 24 10 06 00 00 	movl   $0x6,0x10(%esp)
801091d6:	00 
801091d7:	89 44 24 0c          	mov    %eax,0xc(%esp)
801091db:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801091e2:	00 
801091e3:	89 54 24 04          	mov    %edx,0x4(%esp)
801091e7:	8b 45 f0             	mov    -0x10(%ebp),%eax
801091ea:	89 04 24             	mov    %eax,(%esp)
801091ed:	e8 43 f8 ff ff       	call   80108a35 <mappages>
801091f2:	85 c0                	test   %eax,%eax
801091f4:	78 1b                	js     80109211 <copyuvm+0xfe>
  uint pa, i;
  char *mem;

  if((d = setupkvm()) == 0)
    return 0;
  for(i = 0; i < sz; i += PGSIZE){
801091f6:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801091fd:	8b 45 f4             	mov    -0xc(%ebp),%eax
80109200:	3b 45 0c             	cmp    0xc(%ebp),%eax
80109203:	0f 82 34 ff ff ff    	jb     8010913d <copyuvm+0x2a>
      goto bad;
    memmove(mem, (char*)p2v(pa), PGSIZE);
    if(mappages(d, (void*)i, PGSIZE, v2p(mem), PTE_W|PTE_U) < 0)
      goto bad;
  }
  return d;
80109209:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010920c:	eb 14                	jmp    80109222 <copyuvm+0x10f>
      panic("copyuvm: pte should exist");
    if(!(*pte & PTE_P))
      panic("copyuvm: page not present");
    pa = PTE_ADDR(*pte);
    if((mem = kalloc()) == 0)
      goto bad;
8010920e:	90                   	nop
8010920f:	eb 01                	jmp    80109212 <copyuvm+0xff>
    memmove(mem, (char*)p2v(pa), PGSIZE);
    if(mappages(d, (void*)i, PGSIZE, v2p(mem), PTE_W|PTE_U) < 0)
      goto bad;
80109211:	90                   	nop
  }
  return d;

bad:
  freevm(d);
80109212:	8b 45 f0             	mov    -0x10(%ebp),%eax
80109215:	89 04 24             	mov    %eax,(%esp)
80109218:	e8 16 fe ff ff       	call   80109033 <freevm>
  return 0;
8010921d:	b8 00 00 00 00       	mov    $0x0,%eax
}
80109222:	c9                   	leave  
80109223:	c3                   	ret    

80109224 <uva2ka>:

//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80109224:	55                   	push   %ebp
80109225:	89 e5                	mov    %esp,%ebp
80109227:	83 ec 28             	sub    $0x28,%esp
  pte_t *pte;

  pte = walkpgdir(pgdir, uva, 0);
8010922a:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80109231:	00 
80109232:	8b 45 0c             	mov    0xc(%ebp),%eax
80109235:	89 44 24 04          	mov    %eax,0x4(%esp)
80109239:	8b 45 08             	mov    0x8(%ebp),%eax
8010923c:	89 04 24             	mov    %eax,(%esp)
8010923f:	e8 4f f7 ff ff       	call   80108993 <walkpgdir>
80109244:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if((*pte & PTE_P) == 0)
80109247:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010924a:	8b 00                	mov    (%eax),%eax
8010924c:	83 e0 01             	and    $0x1,%eax
8010924f:	85 c0                	test   %eax,%eax
80109251:	75 07                	jne    8010925a <uva2ka+0x36>
    return 0;
80109253:	b8 00 00 00 00       	mov    $0x0,%eax
80109258:	eb 25                	jmp    8010927f <uva2ka+0x5b>
  if((*pte & PTE_U) == 0)
8010925a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010925d:	8b 00                	mov    (%eax),%eax
8010925f:	83 e0 04             	and    $0x4,%eax
80109262:	85 c0                	test   %eax,%eax
80109264:	75 07                	jne    8010926d <uva2ka+0x49>
    return 0;
80109266:	b8 00 00 00 00       	mov    $0x0,%eax
8010926b:	eb 12                	jmp    8010927f <uva2ka+0x5b>
  return (char*)p2v(PTE_ADDR(*pte));
8010926d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80109270:	8b 00                	mov    (%eax),%eax
80109272:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80109277:	89 04 24             	mov    %eax,(%esp)
8010927a:	e8 91 f2 ff ff       	call   80108510 <p2v>
}
8010927f:	c9                   	leave  
80109280:	c3                   	ret    

80109281 <copyout>:
// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
80109281:	55                   	push   %ebp
80109282:	89 e5                	mov    %esp,%ebp
80109284:	83 ec 28             	sub    $0x28,%esp
  char *buf, *pa0;
  uint n, va0;

  buf = (char*)p;
80109287:	8b 45 10             	mov    0x10(%ebp),%eax
8010928a:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(len > 0){
8010928d:	e9 89 00 00 00       	jmp    8010931b <copyout+0x9a>
    va0 = (uint)PGROUNDDOWN(va);
80109292:	8b 45 0c             	mov    0xc(%ebp),%eax
80109295:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010929a:	89 45 ec             	mov    %eax,-0x14(%ebp)
    pa0 = uva2ka(pgdir, (char*)va0);
8010929d:	8b 45 ec             	mov    -0x14(%ebp),%eax
801092a0:	89 44 24 04          	mov    %eax,0x4(%esp)
801092a4:	8b 45 08             	mov    0x8(%ebp),%eax
801092a7:	89 04 24             	mov    %eax,(%esp)
801092aa:	e8 75 ff ff ff       	call   80109224 <uva2ka>
801092af:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if(pa0 == 0)
801092b2:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801092b6:	75 07                	jne    801092bf <copyout+0x3e>
      return -1;
801092b8:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801092bd:	eb 6b                	jmp    8010932a <copyout+0xa9>
    n = PGSIZE - (va - va0);
801092bf:	8b 45 0c             	mov    0xc(%ebp),%eax
801092c2:	8b 55 ec             	mov    -0x14(%ebp),%edx
801092c5:	89 d1                	mov    %edx,%ecx
801092c7:	29 c1                	sub    %eax,%ecx
801092c9:	89 c8                	mov    %ecx,%eax
801092cb:	05 00 10 00 00       	add    $0x1000,%eax
801092d0:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(n > len)
801092d3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801092d6:	3b 45 14             	cmp    0x14(%ebp),%eax
801092d9:	76 06                	jbe    801092e1 <copyout+0x60>
      n = len;
801092db:	8b 45 14             	mov    0x14(%ebp),%eax
801092de:	89 45 f0             	mov    %eax,-0x10(%ebp)
    memmove(pa0 + (va - va0), buf, n);
801092e1:	8b 45 ec             	mov    -0x14(%ebp),%eax
801092e4:	8b 55 0c             	mov    0xc(%ebp),%edx
801092e7:	29 c2                	sub    %eax,%edx
801092e9:	8b 45 e8             	mov    -0x18(%ebp),%eax
801092ec:	01 c2                	add    %eax,%edx
801092ee:	8b 45 f0             	mov    -0x10(%ebp),%eax
801092f1:	89 44 24 08          	mov    %eax,0x8(%esp)
801092f5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801092f8:	89 44 24 04          	mov    %eax,0x4(%esp)
801092fc:	89 14 24             	mov    %edx,(%esp)
801092ff:	e8 31 cc ff ff       	call   80105f35 <memmove>
    len -= n;
80109304:	8b 45 f0             	mov    -0x10(%ebp),%eax
80109307:	29 45 14             	sub    %eax,0x14(%ebp)
    buf += n;
8010930a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010930d:	01 45 f4             	add    %eax,-0xc(%ebp)
    va = va0 + PGSIZE;
80109310:	8b 45 ec             	mov    -0x14(%ebp),%eax
80109313:	05 00 10 00 00       	add    $0x1000,%eax
80109318:	89 45 0c             	mov    %eax,0xc(%ebp)
{
  char *buf, *pa0;
  uint n, va0;

  buf = (char*)p;
  while(len > 0){
8010931b:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
8010931f:	0f 85 6d ff ff ff    	jne    80109292 <copyout+0x11>
    memmove(pa0 + (va - va0), buf, n);
    len -= n;
    buf += n;
    va = va0 + PGSIZE;
  }
  return 0;
80109325:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010932a:	c9                   	leave  
8010932b:	c3                   	ret    
